Validation of viewstate MAC failed

Probably many of you know this exception: 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 and 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. Add the following attributes to the Page directive in web.config file as in fig below:

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!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.