Validation of viewstate MAC failed

scaldwe

Newcomer
Joined
Oct 25, 2006
Messages
10
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.

This is the error that I am frequently getting. I am not hosted on a web farm or a cluster it is running on VM Ware but I don't know if that makes a difference.

The page I frequently get this error on has many controls including a Multi-View which seems to be more of a pain than it's worth at this point. But that's the way it's done so I will have to stick with it.
I get the error only when posting back to switch between views.

I have placed the work around in my web.config file. <pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" />

I have also put this in the in the Page directive as well (<%@ page ...... viewstateencryptionmode="never" validaterequest="false %>) in the page itself. This work around came from a google solution that work for them but not for me.


Just tried to implement my own validation key and override the machine key. Not sure if this is correct way to do it, I may be missing a step or two.

<pages validateRequest="false" enableEventValidation="true" viewStateEncryptionMode="Auto" enableViewStateMac="true" />
<machineKey validationKey="9787878786A6B626362786B6C6A6873373933626A6B7364766E6F7A6D786C6B7765306E7638336E506A6B736E6476386E6A72686,IsolateApps" />

Pages works fine ... but still throws the error Occasionally...

Any Ideas would be greatly appreciated.
 
Last edited:
viewstate validation fails (solution).

You can do something like this.

<machineKey validation="SHA1" validationKey="EA1236A55DDEC3E61B6DF4FAE3CA93BA50963AD5560AFE725A17E7A755CB74B2F22B537DAA0C087CE952F5799189145DF150E94E120BACAA5E92C3323DD5DA3F" decryptionKey="88844FB4B449D4CB0FAC0E582D882A994CD0A7F3F3D4A699" decryption="AES" />

Put above key in your machine.config(1.1) or web.config(2.0/framework installation directory).

Hope this helps.

Regards,
Nikhilesh Shukla
 
Back
Top