Tuesday, March 24, 2009

ASP.NET MVC - Validation of viewstate MAC failed.

Yup, View State is not supported in MVC, so beware of this. If you try to use a control that relies on it, you'll get the following 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.

Note that you can still use ViewState with ASPX/Web Forms as Views in MVC, but that violates the MVC pattern.

1 comment:

Jay Pondy said...

I received this error after fooling around with a third party control that had placed an extra set of FORM tags into the view - removing them fixed the problem.