Validation of viewstate MAC failed
Hi,
We are getting this error when we create ANTS Load script. We have now changed the web.config to add the following line:
<pages enableViewStateMac="false" enableEventValidation="false"
viewStateEncryptionMode="Never" maxPageStateFieldLength="200" />
Though the error does not occur, the database does not get updated with records.......We have also hard coded the view state, but the main click event or POst does not happen....the code does not get called for the final save event.
Could anyone please help on that?
Regards,
Lakshmi
We are getting this error when we create ANTS Load script. We have now changed the web.config to add the following line:
<pages enableViewStateMac="false" enableEventValidation="false"
viewStateEncryptionMode="Never" maxPageStateFieldLength="200" />
Though the error does not occur, the database does not get updated with records.......We have also hard coded the view state, but the main click event or POst does not happen....the code does not get called for the final save event.
Could anyone please help on that?
Regards,
Lakshmi
Lakshmi
Comments
The Viewstate is the most common beastie that happens when trying to load test an ASP .Net application. Just search this forum to see the various and vicious ways that this happens. More than likely your fix is not helping because viewstate is dynamic and hard-coding it will only lead to different errors.
There seems to be a basic problem with viewstate in your load test. The message about the viewstate MAC, which relates to encryption, is probably a red herring. The real problem is that the viewstate you're sending back to the server is just plain wrong.
The most common cause of this relates to websites that use frames or iframes. This causes viewstate to be sent back to the server for the wrong page, because ANTS Load only has one slot for viewstate data, it is not maintained per-page. Therefore, if your web browser session recorded a request for page a, then b, then c, and your form posts to page b, the viewstate for page c gets posted back to page b.
So what you would need to do is edit your script so that the GET request for page b happens right before the POST to page b. You can try the ANTS Script tester from http://labs.red-gate.com to try to figure out exactly where the breakdown is occurring.
We have already put a GET before every post to get the correct view state....
Also, we have used Fiddler, and the View state from there for each post and hard coded the same and have tried sending the post but does not seem to work.
We have a problem where a particular save button event does not get fired, because of which we are unable to save to the database.....any insights into this would be helpful.
Thanks and Regards,
Lakshmi
We did use the script tester, but we got nothing from there.....
We do not get the error of the View state failed....but no records get inserted into the database.....
Note: At times just putting the GET does not help to get the viewstate.
Regards,
Lakshmi