ASP.NET MVC Validation of viewstate MAC failed error

Posted in MVC | ASP.NET | .NET 3.5 at Saturday, December 13, 2008 2:30 AM GMT Standard Time

If you get a Validation of viewstate MAC failed error on ASP.NET MVC, before trying to hard code your <machineKey attribute in web.config, disabling the keying of viewstate

<system.web>
  <pages enableViewStateMac="false" />
</system.web>

, or any other literature you may want to check if the page you are posting data from has two "<form" attributes (the one hard coded on the page and the one created with Html.BeginForm()). If you play with master templates and have to merge some MVC pages with tradicional ASP.NET you may get to that error.

It took me a while to find the solution...

Did this post save you some time? post it. I'm curious. :) thanks.

AddThis Social Bookmark Button