In ASP.Net, I sometimes get the following error: Viewstate validation failed. Reason: integrity could not be verified in showstate view

Reference Information. I developed a web application in ASP.Net 3.5 in C #. It works fine, but now several users have reported that sometimes they get an error. I tried to duplicate the error, but it was difficult. Once, when I let the application sit, I came back later and tried to move it, and he was mistaken. I think this has something to do with the timeout, but I am using view state.

Any ideas? When I look at eventLog, I see the following error record.

Thanks for your help and ideas!

John


My event log has the following errors:

Event ID: 4005

Event message: Form authentication failed for request. Reason: The ticket has expired.

Event Time: 03/14/2008 13:19:26

Event Time (UTC): 03/14/2008 13:19:26

Event ID: d9f0333c2eed46e0b0207da69d2ea70e

Event Sequence: 154

Event: 5

Event ID: 50202


Event ID: 3005

Event Message: An unhandled exception occurred.

Event Time: 3/12/2009 7:49:59 AM

Event Time (UTC): 3/12/2009 11:49:59 AM

Event ID: 590ac0f6ad734d988e9e02f0fb7800eb

Event Sequence: 52

Event: 1

Event Detail Code: 0

Application Information:

Application domain: /LM/W3SVC/32/ROOT-1-128813294498061103 Trust level: Full Application Virtual Path: / Application Path: C:\Home\LocalUser\ucpga\Web\ Machine name: 169349-WEB2 

Process Information:

 Process ID: 6912 Process name: w3wp.exe Account name: NT AUTHORITY\NETWORK SERVICE 

Here is the last error:

Event ID: 4009 Event Message: Validation check in ViewState failed. Reason: An integrity check error was made in the viewstate. Event Time: 03/15/2009 10:26:27 Event Time (UTC): 3/16/2009 2:26:27 AM Event ID: 3b5be134005e49c3b40400bcaa5cb48d Event Sequence: 56 Event: 1 Event ID: 50203

Application information: Application area: / LM / W3SVC / 32 / ROOT-1-128816433841748972 Level of trust: full Virtual application path: / Application path: C: \ Home \ LocalUser \ ucpga \ Web \ Machine name: 169349-WEB2

Process Information: Process ID: 8892 Process Name: w3wp.exe Account Name: NT AUTHORITY \ NETWORK SERVICE

Request information: Request URL: https://hr.ucpga.org-00-0043/application.aspx Request path: /application.aspx User host address: 74.160.64.222 User:
Authenticated: False Authentication Type:
Topic Title: 169349-WEB2 \ ucpga

ViewStateException Information: Exception Message: Invalid view state. Client IP: 74.160.64.222 Port: 1251 User-Agent: Mozilla / 4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB5; .NET CLR 1.1.4322; InfoPath.1)

+6
visual-studio iis iis-7 viewstate
source share
4 answers

This problem can often be caused by the presence of automatically generated <machineKey /> keys in your machine.config server. Each time your application is restarted, it generates new keys. This will invalidate any existing encrypted widget or authentication forms.

Try setting the values โ€‹โ€‹of <machineKey /> validationKey and decryptionKey to fixed values. For more information, see the following link:

How to configure MachineKey in ASP.NET 2.0 (MSDN)

+10
source share

I highly doubt that this problem has anything to do with ViewState. It is more related to session state and authentication cookies.

Does your app work in a web farm / garden? If so, you should take a look at this article .

If not, this error may occur if your FormsAuthenticationTicket timeout is less than the session timeout. What happens is that the Auth ticket expires before the user session, and the next request cannot be authenticated.

+2
source share

This seems like an authentication issue. You probably set a timeout after the expiration of the validity of the authentication ticket. If you use a sliding timeout, then every time you click on the server, the ticket is renewed. If you do not finish your tickets, you will have to handle this case.


Edit:

You can check this support article to see if it applies to you.

You can also check out this view state view , which can help you determine if the view state is invalid.

Here's another good post from Microsoft Escalation Engineer

+1
source share

I also had this error ....

If you look at the error, your encrypted URL request string is probably yours. It happens that the generated URL string webresource.axd has identifiers that have been encrypted using the machine key parameter. They expire, and if you have a page where you are sitting, try and send it using an encrypted string, event code 1316 or 4009 will be triggered. You can probably block this exception in the Application_Error event and check if a CryptographicException has been thrown.

+1
source share

All Articles