Error - Validation of viewstate MAC failed.

If you get the following error in your ASP.NET application please follow the instructions below:

HttpException (0x80004005): Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.

First you need to generate a machine key. You can do that at the link below:
http://www.allkeysgenerator.com/Random/ASP-Net-MachineKey-Generator.aspx


Once you have the machine key, copy and paste it into your web.config in the root of your application. It should be placed within the system.web tags.

There is more information on machine keys at the link below if you want to know more details on the subject:
http://msdn.microsoft.com/en-us/library/ms998288.aspx

  • Validation of viewstate MAC failed, machine key
  • 838 Users Found This Useful
Was this answer helpful?

Related Articles

404 Error when you have + (plus) character in your URLs

If you receive a 404 error when you have a + (plus) character in your URLs (usually through URL...

Sessions timeout too quickly - Session state issues.

If your sessions are expiring too quickly then please set the site to use ASP.Net State Server....

Error - There is a duplicate 'system.web.extensions/scripting/scriptResourceHandler' section defined

If you receive the error below when you try and edit a websites settings in the control panel...

Error - It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.

If you receive this error when trying to run an application in a sub folder of your website then...

compilation debug="true"

Under no circumstances should any clients use the following option in their web.config files on...