Wednesday, 7 January 2009

ASP - Validation of viewstate MAC failed

So you have an ASP page, and when you click on an entry in a drop down list or a button, i.e. trigger a post back you get a horrible error message:

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.

It may have worked in test or on IIS6 but now you have moved it to IIS7 it dies.
Lots of people talk about setting various page directives and machine keys etc.

However the first thing you should check it that you are posting back to the same page that has the control on it! In IE7 you can hover over the control and check it is posting back to the right page, if its not change the action for the control to be the page it is on.

thansk to this page for giving me the hint by mentioning Server.Transfer

No comments: