Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Validation of viewstate MAC failed. If this application is hosted by a Web Far..."

Tags:

asp.net

i am facing the dreaded:

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.

Error.

Ok so i looking it up and found that it can be caused by two things, viewState which can not be verified by the page, and/or events that can not be validated.

I put

<pages enableEventValidation="false" enableViewStateMac="false" viewStateEncryptionMode="Never">

In my web.config to stop the problem, but that hardly seems like a fix to me.

The thing is, i never even used viewState in my application. I know that asp.net uses viewstate by default to store some things, but i doubt the default values stored here will cause any errors.

I noticed that the problem seems to happen when i postBack and the page has not finished loading yet.

Thanks

Edit: Please, can someone test my website www.vittoriosaStarsNursery.com and see if you get the error i got above? I dont get it locally but people keep telling me they are getting it.

like image 725
TheGateKeeper Avatar asked Sep 08 '11 13:09

TheGateKeeper


People also ask

How do I fix validation ViewState failed MAC?

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.

What is ViewState MAC in asp net?

The ViewState is a parameter specific to the ASP.NET framework, it's used as a breadcrumb trail when the user navigates the application preserving values and controls between different web pages. Present on the pages in the __viewstate parameter, all the values are serialized and encoded in base64 in a hidden field.


1 Answers

Isnt this just a case of putting a one liner in your web.config

<machineKey decryptionKey="A4B12CCDD50E95F8GB9GFH6JKAT4Y0U0I2OF2DF2AAFE5AB46189C,IsolateApps" validation="AES" validationKey="480CDF2AS9S9AS5CFDGF0GHFH9JJH4KHKAKLJ2L9F3SAS82A6C16911A29EF48903783F94529C21570AACB72766FB38CD4CE7B85B0ACE3149DC5FC1CCF1AA1CECE3579659996593B06,IsolateApps"/>
like image 196
Christian Avatar answered Sep 29 '22 08:09

Christian