I am getting the following error whenever I click on a postbacking control
HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I am not using a Web Farm or cluster server. I have even tried setting the page property EnableViewStateMac to false but it changes the error message stating
The state information is invalid for this page and might be corrupted.
What could possibly be wrong?
There is an article about this here: http://blogs.msdn.com/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx .
The basic problem is that Your page hasn’t completed loading before You perform the postback.
A few different solutions are in the article listed above: 1. Set enableEventValidation to false and viewStateEncryptionMode to Never 2. Mark the form as disabled and then enable it in script once the load is complete. 3. override the Render Event of the page to place the hidden fields for Encrypted Viewstate and Event validation on the top of the form.
But the main problem is that the page load slow, which should be fixed (if possible ASAP). It can also be good to apply solution 2 above as well as there will always be trigger happy users that will click faster that the page loads no matter how fast it loads :-).
/Andreas