Apolo
Apolo

Reputation: 4050

Validation of viewstate MAC failed after form submit

So I have this error on ONE computer (not on the two others) :

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, [...]

It is happenning on a dev computer, so everithing runs on the computer, the assertion "If this application is hosted by a Web Farm or cluster" is FALSE

According to the MSDN blog I should remove the action attribute of my form (in ask_full_report.aspx)

<form id="form1" runat="server" method="post" action="full_report.aspx">

But I don't want to remove the action attribute, I want to submit my form to full_report.aspx.

Here is my Web.config (I removed some keys under appSettings)

<configuration>
  <appSettings>
    <add key="URL_BASE" value=""/>
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

For this Answer : I don't use ViewStateUserKey

Do you have any ideas of what is going on please ?

Note : I don't think it is a duplicate of

Extra ressource : MSDN - HttpException Due to Invalid Viewstate After Installing .NET Framework 3.5 SP1


EDIT: Today, without any action taken, I don't have the error anymore. I have left this post open because this error is not well documented. If anyone has a solution, post an answer please.

Upvotes: 0

Views: 205

Answers (1)

Motasem Alsaqqa
Motasem Alsaqqa

Reputation: 61

I've just faced the same problem and the solution was to put the following code in the web.config inside <system.web> like following

<system.web>
<machineKey validationKey="627BF72BB33AA8D28CA2C3E80920BA4DF0B726F97EEFBB0F4818350D63E6AFA380811F13ED1F086E386284654DB3"
decryptionKey="F40B6E5A02B29A181D2D213B5ED8F50B73CFCFD0CC56E137" validation="SHA1" />
    </system.web>

see this to generate your own key if you want

Upvotes: 1

Related Questions