Mono Support WAO View State Issue 

Viewed 11370 time(s), 4 post(s), 5/2/2014 11:40:15 AM - by nasman
5/2/2014 11:40:15 AM
845 Reputation 93 Total posts

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

1
5/2/2014 12:08:20 PM
15993 Reputation 2214 Total posts

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

2
5/2/2014 1:43:42 PM
845 Reputation 93 Total posts

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


3
5/7/2014 1:30:49 PM
15993 Reputation 2214 Total posts

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

4
This is a demo site for MonoX. Please visit Mono Software for more info.