Validation of viewstate MAC failed

Continuing the Roundabout saga…
My app is hosted on a shared server, so today I got a nice message when testing the login page:
Validation of viewstate MAC failed
This exception appears because Controls using DataKeyNames require Viewstate to be encrypted.
The solutions provided here did not worked or were too complicated. In the end it was an one-liner that saved the day:
[code lang=”xml”]<machineKey validationKey="000replaceme000" decryptionKey="111replaceme111" validation="SHA1" decryption="AES" />[/code]
Add this in web.config’s element and that’s it. You can use this tool to generate it.

Leave a Reply

Your email address will not be published. Required fields are marked *