Validation of ViewState Mac failed in ASP.NET 2

2008-04-30


_I met this asp.net Exception when I create a .mobi application followed the new policy of .mobi (I think it is WAP 2.0). I searched Google and got the following article, then I copy to here ((from : http://aspadvice.com/blogs/joteke/archive/2006/02/02/15011.aspx)). Later I will try to use the solution for my application _

**If you get this Exception

[HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]**

and

  • you know for sure that you aren't using a web farm
  • it seems that it appears when using built-in databound controls such as GridView, DetailsView or FormView which utilize DataKeyNames.
  • it appears if you have a large page which loads slowly for any reason