Probably many of you know this exception:
[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.]
If your page doesn’t load slowly and you are not on a web farm, this little tipp might help you. Most people suggest to add the following attributes to the Page directive:
<pages enableEventValidation=“false“ viewStateEncryptionMode =“Never“
This is known to be a security risk and in my case it didn’t fix the problem.
I think I found another way to eliminate the Error, add this to your Button which triggers the Postback Event:
Just post it back to the same site explicitly and you should be fine.
Edit: Another discovery, you can use the maxPageSateFieldLength attribute of the Pages element in the web.config. That will split the viewstate across multiple hidden fields if the content length is larger than maxPageSateFieldLength.
Hope that helps!