Hi Tiang,

Sources on the Internet state that this error occurs when a page is posted back 
to a web server via an ASP.NET Button or Link control.

The issue can also occur within an ASP.NET 2.0 GridView, DetailsView, or 
FormView that utilize the DataKeyNames property

More complex details on this error can be found in the links below:

http://forums.asp.net/t/955145.aspx?PageIndex=1
http://aspadvice.com/blogs/joteke/archive/2006/02/02/15011.aspx

Unfortunately, there is more than one combination of fixes to this problem.

Solution:
The solution that fixed this problem for me is to add the following element 
(and attributes) to a Web applications Web.Config file:
<pages validateRequest="false"
            enableEventValidation="false"
            viewStateEncryptionMode="Never"
            enableViewStateMac="false">
</pages>

NOTE:  The <pages> element resides as a child under the <system.web> element

Cheers,
Raj

"Tough Times Never Last, But Tough People Do"

From: [email protected] [mailto:[email protected]] On 
Behalf Of Tiang Cheng
Sent: Tuesday, 1 June 2010 9:43 AM
To: ozDotNet
Subject: ASP.NET MAC Validation issue

Hi all,

I'm receiving a http web exception "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."


I've added a machineKey to my web.config under the <system.web>, which defines 
a validation key and algorithm.  Only it's still coming up with the error still.

Has anyone else had any experience with this error and can point me in the 
right direction?

Cheers,
Tiang



________________________________
FREMANTLE PORTS, 1 Cliff Street, Fremantle, Western Australia 6160. Telephone: 
+61 8 9430 3555
TO THE ADDRESSEE: We cannot guarantee the reliability, completeness or 
confidentiality of this Communication (this term includes all attachments).
IF YOU ARE NOT THE INTENDED ADDRESSEE: Material in this communication is 
confidential and may be legally privileged. No confidentiality is lost or 
privilege waived by your receipt of it. Please notify us if you have received 
it.
VIRUS WARNING AND DISCLAIMER: Although we virus-scan all outgoing e-mail, we 
cannot guarantee that this Communication is free from viruses, Trojan horses, 
worms or anything else that may interfere with or damage the operation of your 
computer systems, and we accept no liability for any such interference or 
damage. You should check the Communication (and all other incoming e-mail) with 
current virus-scanning software.

Reply via email to