ASP.NET Viewstate Error Question
We have an asp.net webpage that uses viewstate. During a lengthy operation (that takes more than 12 minutes) there happens a view state related error as listed below.
The controls from the page gets vanished.
It simply writes on the screens as
"input t开发者_Go百科ype=”hidden” name= ”_VIEWSTATE” id= ”_VIEWSTATE” value =’/wEPDw…”
When the viewstate is avoided, this is working fine. One more observation is that when we connect to the VPN and run it as intranet, it is working fine even with viewstate.
I have read from Does viewstate expire? that “Even though ViewState won't expire, it can become invalid if a different autogenerated key is used to decrypt ViewState, such as after an IIS Reset, redeploying an application, or hitting a different server in a web farm.”
• We have a load balancer (with two web servers)
• We are not restarting IIS
• We are not redeploying the application during the test
So, what are the possible reasons for this error? How can we resolve it without removing viewstate?
Can this be related to Proxy server truncating View State ? How to confirm that whether it is a problem caused by proxy or firewall?
Thanks
Lijo
We have a load balancer (with two web servers)
So ensure that you have specified the same machine keys on both your web servers instead of the default autogenerated value. You could also specify this value in the web.config of your application:
<machineKey
validationKey="21F090935F6..."
decryptionKey="ABAA84D7EC4..."
validation="SHA1"
decryption="AES"
/>
This will ensure that no matter which web server encrypted the viewstate the other will be able to decrypt it. You could also use an online tool for generating machine keys.
精彩评论