Asp – Validation of viewstate MAC failed

.net-3.5asp.netiisnetviewstate

I am currently receiving this 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.

I have found multiple solutions to this error. The solution we are currently using is to add a static MachineKey field at the machine level and to use static validation keys and decryption keys.

<MachineKey validationKey="" decryptionKey="" validation="SHA1" decruption="AES" />

Will this solution work for .NET 3.5? Is there a more elegant solution?

Best Answer

Is your web app hosted in a webfarm?

If so, the reason for this is that a page is rendered by server 1, and posted to server 2. Therefore, machine keys are different, and the validation failed.

It will work on ASP.NET 3.5 as well.

Related Topic