Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
i have hosted a website on my local system. but it throws following error.

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.

for that i made changes in web.config as follows


XML
<?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <customErrors mode="Off"></customErrors>
    <authentication mode="None"></authentication>
    <pages enableEventValidation="false" viewStateEncryptionMode="Never" />
    <machineKey validation="SHA1" validationKey="A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1B2C3D4E5" decryption="Auto" decryptionKey="A1B2C3D4E5F6F6E5D4C3B2A1A1B2C3D4E5F6F6E5D4C3B2A1" />
  </system.web>
  <connectionStrings>
    <add name="constr" connectionString="Data Source=RAJEEV-PC; Initial Catalog=Hindalco_muri; Integrated Security=True;"/>
  </connectionStrings>
</configuration>



still i m getting same error. please help me
Posted
Comments
_Asif_ 26-Jun-14 8:31am    
Are you running your application in a cluster/Webform?
TAUSEEF KALDANE 26-Jun-14 8:34am    
how would i know about whether i m running application in cluster/Webform or not.
Philippe Mori 26-Jun-14 8:33am    
From where come the validation and decryption keys?
Wombaticus 26-Jun-14 8:38am    
This is a nightmare error, as it can have so many causes ... one rarely documented one is if you are using any kind of URL-rewriting ..

You may also want to try adding the following to your system.web section in config:
<pages renderAllHiddenFieldsAtTopOfForm="true" controlRenderingCompatibilityVersion="4.0"/>
<httpruntime requestvalidationmode="2.0"/></httpruntime/>
TAUSEEF KALDANE 27-Jun-14 1:03am    
i tried this but getting same error plz help me

1 solution

Turning off ViewState MAC is a very bad idea, and is no longer supported as of .NET 4.5.2:
http://blogs.msdn.com/b/webdev/archive/2014/05/07/asp-net-4-5-2-and-enableviewstatemac.aspx[^]

Microsoft have published a knowledgebase article which might help:
Resolving view state message authentication code (MAC) errors[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900