Saturday, April 21, 2012

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

Here are few steps to fix "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" error.

Step 1 : Visit this link and generate your machine key.
http://www.eggheadcafe.com/articles/GenerateMachineKey/GenerateMachineKey.aspx

Step 2 : Copy the machine key given by above link and paste it to your web.config file.


<?xml version=”1.0″?>

<configuration>

    <appSettings/>
    <connectionStrings/>
    <system.web>

       <machineKey validationKey='4C8B22744D71B73CE6B16262A97CF3862E584829229EDE45C9DF207DDF5F3507782A3F2F6506085028628868F6AFFC25D16BE4AD8BB677637B11C892F95FE819'   decryptionKey='53EA49CFEC5C5A1E4720DE83E1CC75337674757144EB1DCB'   validation='SHA1'/>

    </system.web>
</configuration>


Step 3 : By doing above two steps you will be relieved by this error.But you must know why this error occurs.To get a good detail about this error you must visit this link.

http://www.codeproject.com/Articles/16645/ASP-NET-machineKey-Generator

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Hi Anukana,

    Keep the good work up. Just adding bit more to your article, any one having same problem "Validation of viewstate MAC failed"it might be because you are hosting subdomains runing multimple ASP.NET applications. You will be able to resolve the problem as Anukana explained above just apply the solution for each app in web.config.

    Regards
    Manik

    ReplyDelete
  3. Hello annu,
    This is not Working for me.
    Any Solution Please mail me at nitinverma274@gmail.com

    Thanks

    ReplyDelete
  4. Hi,
    I'm facing error on " 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." Using ASP.NET framework 4.0

    by Karthik

    ReplyDelete