|
Hi,
I am getting the below error in my ASP.NET 4.0 web application:
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 started getting this error when I added the below tag in web.config to encrypt the viewstate:
<pages enableEventValidation="true" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" enableViewStateMac="true" viewStateEncryptionMode="Always"/>
<machineKey validationKey="9EFA2D2E71A1BC8ECAF76E2377F29E61AB0214D893EBDBBD49C594A94FB0A2336BA3023F1578BFFE7ACD09C56872885537D07F5FA8FFF0FE4CD8B0E955A02845" decryptionKey="3EBF84F260F8883A69379502DF6DC999ADCAAA90885EAB1BD0423CEED13526A4" validation="SHA1" decryption="AES"/>
I looked for lot of solutions on aspnet forums and Internet but nothing worked. If I change the viewStateEncryptionMode to "Auto" or "Never", then the page loads fine. But that would make my application insecure and security is my prime objective.
FYI:My application is deployed on a Windows 2008 R2 server and not on a webfarm.
Any solution to solve this issue?
|
|
|
|
|
First, just to check the simplest solution, you aren't posting back "old" pages are you? By this I mean getting the page when the viewstateEncryptionMode is off/auto, switching the mode to on then posting back. This wide cause the error, but is unlikely Tokyo are doing this.
This problem is ringing a bell, but I can't place my finger on it. You might be suffering from this http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx (On my mobile so can't make clickety),though this was fixed IIRC.
|
|
|
|
|
Are you using Shared Hosting Environment?
|
|
|
|
|
Hi Karthick,
Are you asking whether our web server hosts other applications also apart from the application I am talking about here. If you agree to this, then my answer is yes.
|
|
|
|
|
no i am asking about the type of hosting..Where its leased or own.
|
|
|
|
|
k.. any particular page is displaying this error or whole application
|
|
|
|
|
I am seeing this issue only on particular pages and not all. Is there something I should specifically check on those pages?
|
|
|
|
|
yes..If ur using data reader ..make sure that connection is closed..
|
|
|
|