title: System.Web.HttpException: Validation of viewstate MAC failed in ASP.NET
body: <p>I have developed an application in asp.net . Now I am trying to host it in another Server . When I run this application from that server  I am getting the following error : </p>
  
  <pre><code>Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that &lt;machineKey&gt; configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. 
  </code></pre>
  
  <p>The stack trace is as follows : </p>
  
  <pre><code>[ViewStateException: Invalid viewstate. 
      Client IP: 10.11.201.84
      Port: 62640
      User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/8.0; .NET4.0C; .NET4.0E; InfoPath.3; .NET CLR 2.0.50727; .NET CLR 3.0.30729; .NET CLR 3.5.30729; .NET CLR 1.1.4322)
      ViewState: /wEPDwUKLTE4MDU5MzAwNg9kFgICAw8WAh4GYWN0aW9uBWpmYW12ZXJpZnlIb21lLmFzcHg/bmFtZT05ODkmYXBwdXNlcj0nUkFOQTAwMScmYWlsb2dpZD0nMScmZGVwYW1vdW50PSZzZXNzaWQ9JzI4OTAyMzQzMDkzMTQ1ICcmY3VzdG5vPSc5ODknZGQ43r63dbDPk+BB/tFxs4xJkThUIQ==
      Referer: http://10.11.201.170/finger/startverifyHome.aspx?name=989&amp;ailogid='1'&amp;appuser='RANA001'&amp;depamount=&amp;custno='989'&amp;sessid='28902343093145%20'
      Path: /finger/famverifyHome.aspx]
  
  [HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that &lt;machineKey&gt; configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.]
     System.Web.UI.ViewStateException.ThrowError(Exception inner, String persistedState, String errorPageMessage, Boolean macValidationError) +106
     System.Web.UI.ViewStateException.ThrowMacValidationError(Exception inner, String persistedState) +14
     System.Web.UI.ObjectStateFormatter.Deserialize(String inputString) +237
     System.Web.UI.ObjectStateFormatter.System.Web.UI.IStateFormatter.Deserialize(String serializedState) +4
     System.Web.UI.Util.DeserializeWithAssert(IStateFormatter formatter, String serializedState) +37
     System.Web.UI.HiddenFieldPageStatePersister.Load() +207
     System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +105
     System.Web.UI.Page.LoadAllState() +43
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
     System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
     System.Web.UI.Page.ProcessRequest() +80
     System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
     System.Web.UI.Page.ProcessRequest(HttpContext context) +49
     ASP.famverifyhome_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\finger\7c8a0dc9\bf1de8ca\App_Web_yhgsi6y0.0.cs:0
     System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
     System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +75
  </code></pre>
  
  <p><a href="https://stackoverflow.com/questions/5840899/asp-net-validation-of-viewstate-mac-failed">I have followed this tutorial</a> . </p>
  
  <ol>
  <li>I have opened IIS and selected my website to get this screen : </li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/nEQf2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nEQf2.png" alt="enter image description here"></a></p>
  
  <ol start="2">
  <li>I have double clicked the Machine Key icon to get this screen:
  <a href="https://i.stack.imgur.com/DnEFL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DnEFL.png" alt="enter image description here"></a></li>
  </ol>
  
  <p>Then when I have generated the key , the following is entered in my web.config file . </p>
  
  <pre><code>&lt;machineKey decryption="AES" decryptionKey="A9392EC7910C......CF5F8D31AD08B1E68AAEA94BEB939C" validation="SHA1" validationKey="2763A48574235661A1......21F289237DE25A14EF0EF97BCFE1A78B2F0B504E5F9021422E737F11D26CD5DD0D311F17AD93BC5E486C8907159C6252FE8C70DE" /&gt;
  </code></pre>
  
  <p>But still my problem is not solved . How can I solve this problem ? Please help me . </p>