Validation of viewstate MAC failed.

If you get 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.

 

you need to generate a machine key and paste it into web.config

 

Online tool to generate key Click Here

 

example output

<machineKey validationKey=”E578693F3C66EA5556A999JEE6EB664D97BDA5F16429191D61902360C15DCF643251C2D252289BF864194788705046419544ED98B8ED4CD00E6F753D5CD8A1F0″ decryptionKey=”1E0D96FD28C3594E30375512A5FEDDC34015550D46A88F28D217A2A9344B3D48″ validation=”SHA1″ decryption=”AES” />