Jump to content
WAPT Forum
Sign in to follow this  
Guest Craig

Invalid Viewstate in .NET

Recommended Posts

Guest Craig

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!

Share this post


Link to post
Share on other sites
Guest angela

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.

 

 

Share this post


Link to post
Share on other sites
Guest Craig
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?

post-12-1203532723.jpg

Share this post


Link to post
Share on other sites
Guest Craig
The problem has been solved in the latest build, please get it here:

http://www.uploading.com/files/ZQN422FN/wapt-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& 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.

Share this post


Link to post
Share on other sites
Guest angela

Hi Craig,

 

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

 

Share this post


Link to post
Share on other sites
Guest angela

 

Hi,

 

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

 

http://connect.microsoft.com/VisualStudio/...edbackID=101988

http://aspadvice.com/blogs/joteke/archive/...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.

 

 

Share this post


Link to post
Share on other sites
Guest jmurri

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.

 

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

 

http://www.loadtestingtool.com/forum/builds/wapt50.exe

 

Share this post


Link to post
Share on other sites
Guest angela

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.

Share this post


Link to post
Share on other sites
Guest Amit
Here is the build in which the problem seems to have been fixed. Please get it here:

 

http://www.loadtestingtool.com/forum/builds/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& dataLength) +195

System.Web.UI.LosFormatter.Deserialize(String input) +59

 

[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> 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/Web/EnrollNow_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

Share this post


Link to post
Share on other sites
Guest angela
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& dataLength) +195

System.Web.UI.LosFormatter.Deserialize(String input) +59

 

[HttpException (0x80004005): Authentication of viewstate failed. 1) If this is a cluster, edit <machineKey> 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/Web/EnrollNow_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.loadtestingtool.com/forum/files/

 

Let me know if the problem remains.

 

Share this post


Link to post
Share on other sites
Guest Amit
Please try to download the latest build here - http://www.loadtestingtool.com/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

Share this post


Link to post
Share on other sites
Guest angela
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.

Share this post


Link to post
Share on other sites
Guest 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.

 

Hi Angela,

 

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

 

Regards,

Amit

Share this post


Link to post
Share on other sites
Guest angela
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.

Share this post


Link to post
Share on other sites
Guest Amit
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

Share this post


Link to post
Share on other sites
Guest angela
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.

Share this post


Link to post
Share on other sites
Guest angela
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?

 

Share this post


Link to post
Share on other sites
Guest Amit
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

Beneficiary.html

Share this post


Link to post
Share on other sites
Guest angela
Hi,

 

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

 

Thanks,

Amit

 

Hi Amit,

 

We tested the page, and it was without any errors. So could you please send to us your scenario, profile, Full and Error logs? Logs are especially important.

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...