1

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?

p.campbell
  • 95,348
  • 63
  • 249
  • 319
tbrownell
  • 23
  • 1
  • 4

1 Answers1

2

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.

MartinHN
  • 19,112
  • 18
  • 85
  • 130