Validation of viewstate MAC failed

Forum for users of ANTS web server load testing tool

Moderator: Brian Donahue

Validation of viewstate MAC failed

Postby Lakshmi » Sat Feb 24, 2007 2:49 pm

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
Lakshmi
Lakshmi
 
Posts: 11
Joined: Wed May 17, 2006 8:28 am
Location: Mysore

Postby Brian Donahue » Sun Feb 25, 2007 7:15 pm

Hi,

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.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby Lakshmi » Tue Feb 27, 2007 12:57 pm

Hi Brian,

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
Lakshmi
Lakshmi
 
Posts: 11
Joined: Wed May 17, 2006 8:28 am
Location: Mysore

Postby Brian Donahue » Tue Feb 27, 2007 10:41 pm

Hard-coding the viewstate is a very bad idea. Did the script tester reveal anything?
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

No Records being inserted into the Database

Postby Lakshmi » Wed Feb 28, 2007 6:13 am

Hi Brian,

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
Lakshmi
Lakshmi
 
Posts: 11
Joined: Wed May 17, 2006 8:28 am
Location: Mysore

Postby Brian Donahue » Wed Feb 28, 2007 10:14 am

This looks like one of the typical application-specific errors to do with ANTS Load. I can't help really, except to suggest using Me.LogToFile on your sessions' scripts and seeing if the pages returned in the response content are correct. In a few cases, the scripts work once, but fail on subsequent attempts because of data that is meant to be dynamic being static in the ANTS Load script, or a script not logging the user out at the end, the result is usually a bunch of 'you must log in' pages in the second run.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am


Return to ANTS Load

Who is online

Users browsing this forum: No registered users and 0 guests