Validation of viewstate MAC failed

If your dotnet application produces this error:

HttpException (0x80004005): 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.
 
Our servers are all standalone servers and do not use webfarms.  You can use one of the following methods to resolve your issue:
 
 
1) You can add the  <pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" />
to the <system.web> section of your web.config file.
<configuration>
  <system.web>

    <pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode ="Never" />

  </system.web>
</configuration>
 
 
2) This option is adding a machine key setting to the <system.web> section of your web.config file.
 

<configuration>
  <system.web>

    <machineKey decryptionKey="Decryption key goes here,IsolateApps" validationKey="Validation key goes here,IsolateApps" />

  </system.web>
</configuration>

Add Feedback