Jump to content


Invalid Viewstate in .NET


  • Please log in to reply
20 replies to this topic

#1 Guest_Craig_*

Guest_Craig_*
  • Guests

Posted 18 February 2008 - 05:29 PM

When running a load test against a .NET2 website, the test bombs out with the majority of pages returning a 500 Internal server error. When I check the logs for the test, the error being returned is:

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

Here are some more details:

Accept: text/html, */*
Accept-Language: en-us, *
Accept-Encoding: compress, gzip, *
Pragma: no-cache
User-Agent: Mozilla/5.0 (compatible; WAPT; Windows)

__VIEWSTATE=/wEPDwULLTEzNzYxMDU5OTdkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYCBQlpbWJQd
WJsaWMFCmltYkFjY291bnSyCN7W5mpAyPLMkCbyGOODWGKw8A==&__EVENTVALIDATION=/wEWAwLRg4fDAQKwjv++CwK+xrjVA3MDJnHREjq7/Am8Hy5+8BlIE1kM&imbPublic.x=54&imbPublic.y=26

<snip>

[ViewStateException: Invalid viewstate.
Client IP:
Port: 1009
User-Agent: Mozilla/5.0 (compatible; WAPT; Windows)
ViewState: /wEWAwLRg4fDAQKwjv CwK xrjVA3MDJnHREjq7/Am8Hy5 8BlIE1kM
Referer:
Path: /Default.aspx]

I noticed the viewstate in the exception does not match the __VIEWSTATE that WAPT is sending?

Help!

#2 Guest_angela_*

Guest_angela_*
  • Guests

Posted 19 February 2008 - 03:06 PM

Hi,

Most probably, your __VIEWSTATE is written as a static text, and you need to specify it as $Hidden variable. Please check and let me know.



#3 Guest_Craig_*

Guest_Craig_*
  • Guests

Posted 20 February 2008 - 06:39 PM

QUOTE (angela @ Feb 19 2008, 07:06 AM) <{POST_SNAPBACK}>
Hi,

Most probably, your __VIEWSTATE is written as a static text, and you need to specify it as $Hidden variable. Please check and let me know.


I've attached an image of the parameters that are set as part of one of the requests. This was recorded with WAPT5 which seems to handle viewstate as a variable.

One thing I did notice is that the viewstate information in the exception seems to match the __EVENTVALIDATION text. So it seems perhaps there is a bug in WAPT where it is mixing up __VIEWSTATE and __EVENTVALIDATION?

Attached Files



#4 Guest_angela_*

Guest_angela_*
  • Guests

Posted 22 February 2008 - 09:26 AM

The problem has been solved in the latest build, please get it here:
http://www.uploading...apt-50.zip.html

#5 Guest_Craig_*

Guest_Craig_*
  • Guests

Posted 28 February 2008 - 11:23 PM

QUOTE (angela @ Feb 22 2008, 01:26 AM) <{POST_SNAPBACK}>
The problem has been solved in the latest build, please get it here:
http://www.uploading...apt-50.zip.html


I just tried running through the test script again - the problem persists:

<% 15:18:27 Request %>
POST /Default.aspx HTTP/1.1
Cookie: ASP.NET_SessionId=c5sz3g2hmujveuqab2enqr55
Content-Type: application/x-www-form-urlencoded
Content-Length: 249
Host:
Referer:
Connection: Keep-Alive
Accept: text/html, */*
Accept-Language: en-us, *
Accept-Encoding: compress, gzip, *
Pragma: no-cache
User-Agent: Mozilla/5.0 (compatible; WAPT; Windows)

__EVENTVALIDATION=/wEWAwLRg4fDAQKwjv++CwK+xrjVA3MDJnHREjq7/Am8Hy5+8BlIE1kM&imbPublic.x=78&imbPublic.y=32&__VIEWSTATE=/wEPDwULLTEzNzYxMDU5OTdkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYCBQlpbWJQd
WJsaWMFCmltYkFjY291bnSyCN7W5mpAyPLMkCbyGOODWGKw8A==

<% 15:18:27 Response-Failed(500) %>
HTTP/1.1 500 Internal Server Error
Date: Thu, 28 Feb 2008 23:18:27 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 7651

[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKeySection.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32&amp; dataLength) +2646292
System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +214

[ViewStateException: Invalid viewstate.
Client IP:
Port: 1004
User-Agent: Mozilla/5.0 (compatible; WAPT; Windows)
ViewState: /wEWAwLRg4fDAQKwjv CwK xrjVA3MDJnHREjq7/Am8Hy5 8BlIE1kM
Referer: http://tst2.publications.gov.bc.ca/
Path: /Default.aspx]


The viewstate exception shows the __VIEWSTATE the same as the __EVENTVALIDATION.

#6 Guest_angela_*

Guest_angela_*
  • Guests

Posted 29 February 2008 - 08:06 AM

Hi Craig,

We are sorry to know that the problem persists sad.gif Please send to us your scenario, profile, full and error logs (to support@loadtestingtool.com).


#7 Guest_angela_*

Guest_angela_*
  • Guests

Posted 04 March 2008 - 11:14 AM


Hi,

__VIEWSTATE and __EVENTVALIDATION are not switched, but it seems that the problem is in ASP.NET 2.0:

http://connect.micro...edbackID=101988
http://aspadvice.com...2/02/15011.aspx


As a workaround, please add the following string: <pages enableEventValidation="false" viewStateEncryptionMode ="Never" /> to the file web.config.

Let me know if the problem remains.



#8 Guest_angela_*

Guest_angela_*
  • Guests

Posted 06 March 2008 - 09:22 AM

Here is the build in which the problem seems to have been fixed. Please get it here:

http://www.loadtesti...ilds/wapt50.exe

#9 Guest_jmurri_*

Guest_jmurri_*
  • Guests

Posted 10 March 2008 - 10:28 AM

Is there a way to run an "update" install? From the command line maybe? When I try to install the new build it wants to "uninstall". I don't want to uinstall. I want to upgrade.

Thanks and best wishes,
Jeff M.

QUOTE (angela @ Mar 6 2008, 03:22 AM) <{POST_SNAPBACK}>
Here is the build in which the problem seems to have been fixed. Please get it here:

http://www.loadtesti...ilds/wapt50.exe



#10 Guest_angela_*

Guest_angela_*
  • Guests

Posted 11 March 2008 - 05:27 AM

Hi Jeff,

It is the way the Installer works now. It needs to uninstall the old version first. However, this procedure will not influence your WAPT files (your scenarios, profiles, logs and reports).
If the file of your current build is saved somewhere on your computer, you will be able to replace with it the newer one later, if necessary.

#11 Guest_Amit_*

Guest_Amit_*
  • Guests

Posted 05 June 2008 - 10:25 PM

QUOTE (angela @ Mar 6 2008, 02:22 AM) <{POST_SNAPBACK}>
Here is the build in which the problem seems to have been fixed. Please get it here:

http://www.loadtesti...ilds/wapt50.exe



Hi Angela,

I have downloaded the tool from the above link but I am getting the similar viewstate error. I am using .NET Framework 1.1 for my web application so <Pages> attribute is not available to me. The error which I received is as below:

[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32&amp; dataLength) +195
System.Web.UI.LosFormatter.Deserialize(String input) +59

[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit &lt;machineKey&gt; configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +117
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +101

[HttpException (0x80004005): Invalid_Viewstate
Client IP: 0.0.0.0
Port: 56243
User-Agent: * IE 6.0 *
ViewState: =
Http-Referer: https://localhost/We...llNow_Life.aspx
Path: /Web/EmployeeBeneficiary.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +447
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447


Can you please let me know the cause for this error? My viewstate size is quite large (25+KB).

Thanks

#12 Guest_angela_*

Guest_angela_*
  • Guests

Posted 06 June 2008 - 09:35 AM

QUOTE (Amit @ Jun 6 2008, 05:25 AM) <{POST_SNAPBACK}>
Hi Angela,

I have downloaded the tool from the above link but I am getting the similar viewstate error. I am using .NET Framework 1.1 for my web application so <Pages> attribute is not available to me. The error which I received is as below:

[HttpException (0x80004005): Unable to validate data.]
System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32&amp; dataLength) +195
System.Web.UI.LosFormatter.Deserialize(String input) +59

[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit &lt;machineKey&gt; configuration so all servers use the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 2) Viewstate can only be posted back to the same page. 3) The viewstate for this page might be corrupted.]
System.Web.UI.LosFormatter.Deserialize(String input) +117
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +101

[HttpException (0x80004005): Invalid_Viewstate
Client IP: 0.0.0.0
Port: 56243
User-Agent: * IE 6.0 *
ViewState: =
Http-Referer: https://localhost/We...llNow_Life.aspx
Path: /Web/EmployeeBeneficiary.aspx.]
System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +447
System.Web.UI.Page.LoadPageViewState() +18
System.Web.UI.Page.ProcessRequestMain() +447


Can you please let me know the cause for this error? My viewstate size is quite large (25+KB).

Thanks


Please try to download the latest build here - http://www.loadtesti...om/forum/files/

Let me know if the problem remains.


#13 Guest_Amit_*

Guest_Amit_*
  • Guests

Posted 06 June 2008 - 06:42 PM

QUOTE (angela @ Jun 6 2008, 02:35 AM) <{POST_SNAPBACK}>
Please try to download the latest build here - http://www.loadtesti...om/forum/files/

Let me know if the problem remains.


Hi,

With the new build provided by you, I am continue getting the same viewstate error on the same page. Viewstate is used on several other pages as well then why I am getting an error on this same page? Is there any limit for viewstate size?

Thanks,
Amit

#14 Guest_angela_*

Guest_angela_*
  • Guests

Posted 06 June 2008 - 07:12 PM

QUOTE (Amit @ Jun 7 2008, 01:42 AM) <{POST_SNAPBACK}>
Hi,

With the new build provided by you, I am continue getting the same viewstate error on the same page. Viewstate is used on several other pages as well then why I am getting an error on this same page? Is there any limit for viewstate size?

Thanks,
Amit


Hi Amit,

Possibly it is a bug. On Monday we will try to find the reason of the problem and I will let you know.

#15 Guest_Amit_*

Guest_Amit_*
  • Guests

Posted 09 June 2008 - 06:35 PM

QUOTE (angela @ Jun 6 2008, 12:12 PM) <{POST_SNAPBACK}>
Hi Amit,

Possibly it is a bug. On Monday we will try to find the reason of the problem and I will let you know.


Hi Angela,

Are there any updates on the Viewstate problem reported by me on Friday, 6th June?

Regards,
Amit

#16 Guest_angela_*

Guest_angela_*
  • Guests

Posted 10 June 2008 - 09:16 AM

QUOTE (Amit @ Jun 10 2008, 01:35 AM) <{POST_SNAPBACK}>
Hi Angela,

Are there any updates on the Viewstate problem reported by me on Friday, 6th June?

Regards,
Amit


Hi Amit, we are trying to find the reason of the problem now. I will let you know as soon as we do.

#17 Guest_Amit_*

Guest_Amit_*
  • Guests

Posted 11 June 2008 - 06:03 PM

QUOTE (angela @ Jun 10 2008, 02:16 AM) <{POST_SNAPBACK}>
Hi Amit, we are trying to find the reason of the problem now. I will let you know as soon as we do.


Hi Angela,

We need to finalize on load testing tool this week and our client is pressurizing us to do the same. Can you please let me know the estimated timeline till this issue gets resolved?

Regards,
Amit Thorve

#18 Guest_angela_*

Guest_angela_*
  • Guests

Posted 12 June 2008 - 04:19 PM

QUOTE (Amit @ Jun 12 2008, 01:03 AM) <{POST_SNAPBACK}>
Hi Angela,

We need to finalize on load testing tool this week and our client is pressurizing us to do the same. Can you please let me know the estimated timeline till this issue gets resolved?

Regards,
Amit Thorve


Hi Amit!
We are trying to reproduce the problem. Could you provide an access to your application? It would help us a lot. In any case, tomorrow I will let you know about the results.

#19 Guest_angela_*

Guest_angela_*
  • Guests

Posted 13 June 2008 - 11:15 AM

QUOTE (angela @ Jun 12 2008, 11:19 PM) <{POST_SNAPBACK}>
Hi Amit!
We are trying to reproduce the problem. Could you provide an access to your application? It would help us a lot. In any case, tomorrow I will let you know about the results.


We tried to reproduce, and failed. Could you possibly show the html code of the page which causes the problem?


#20 Guest_Amit_*

Guest_Amit_*
  • Guests

Posted 13 June 2008 - 07:36 PM

QUOTE (angela @ Jun 13 2008, 03:15 AM) <{POST_SNAPBACK}>
We tried to reproduce, and failed. Could you possibly show the html code of the page which causes the problem?


Hi,

Please find attached herewith the HTML request for the page where I am facing the viewstate problem.

Thanks,
Amit

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users