MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

WAO View State Issue  (Mono Support )

Viewed 10155 time(s), 4 post(s) 5/2/2014 11:40:15 AMby nasman
nasman

nasman

5/2/2014 11:40:15 AM
hi,

I am using SqlProvider for the ViewStates .If I do alot of post backs on a same page then sometime I get following error message. 

Any thoughts?

Many thanks

Server Error in '/' Application.Violation of PRIMARY KEY constraint 'PK_WAOViewStateData'. Cannot insert duplicate key in object 'dbo.WAOViewStateData'. The duplicate key value is (VIEWSTATE_fokuma4mj3d1hrh5wyppkiay_567609788_635346299515750645).
The statement has been terminated.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'PK_WAOViewStateData'. Cannot insert duplicate key in object 'dbo.WAOViewStateData'. The duplicate key value is (VIEWSTATE_fokuma4mj3d1hrh5wyppkiay_567609788_635346299515750645).
The statement has been terminated.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace: 

[SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_WAOViewStateData'. Cannot insert duplicate key in object 'dbo.WAOViewStateData'. The duplicate key value is (VIEWSTATE_fokuma4mj3d1hrh5wyppkiay_567609788_635346299515750645).
The statement has been terminated.]
MonoSoftware.Web.WAO.ViewState.Providers.SqlProvider.Save() +1416
System.Web.UI.Page.SaveAllState() +1158
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4860

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446
This content has not been rated yet. 
845 Reputation 93 Total posts
khorvat

khorvat

5/2/2014 12:08:20 PM
This seems very odd, or to put it differently, hard to produce. Can you please try to get back to us with the WAO version and try to compile a list of steps that we need to take in order to reproduce the issue.

Thanks
This content has not been rated yet. 
15993 Reputation 2214 Total posts
nasman

nasman

5/2/2014 1:43:42 PM
Hi khorvat,

Thanks for your reply. WAO version is 1.0.2.200. I am posting a  form with this.AjaxifiedPage = true;. After posting a same form couple of times I get this error message.

I think, MonoSoftware.Web.WAO.ViewState.Providers.SqlProvider.Save() method should check the id in the  database . If id is already exist in the database  then  it should update the existing view state record instead of inserting a  new record with the same ID.


Many thanks


This content has not been rated yet. 
845 Reputation 93 Total posts
khorvat

khorvat

5/7/2014 1:30:49 PM
Hi,

the workflow that you have describe is incorrect so viewstate items should never be updated (e.g. you can always go back in your browser and you state should be maintained in that scenario). I have attached the zip file with the latest version of WAO (1.0.2.216) please try to reproduce the issue with the latest version and get back to us. If you reproduce the issue please try to provide more details on how to reproduce the issue.

Thanks
This content has not been rated yet. 
15993 Reputation 2214 Total posts