Wednesday, August 15, 2007

Error: Validation of viewstate MAC failed. in ASP.NET page

Full error:

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.


This error may occur when one hosts an ASP.NET webpage on a web-garden.

Simple solution (for ASP.NET 2.0 and up): Generate a new machinekey and add it to the web.config.

Full explanation can be found in the blog of Jody.