Wednesday, November 10, 2010

Validation of viewstate MAC failed

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 & validation algorithm. AutoGenerate cannot be used in a cluster.

Solution:
Disable viewstate change by adding this to the affected aspx page.
EnableViewState="false" EnableEventValidation="false" enableViewStateMac=false

For example:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="myLogin" EnableViewState="false" EnableEventValidation="false" enableViewStateMac=false %>

No comments: