views:

1249

answers:

3

Hello everyone,

I am currently receiving the below error:

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.

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. Example:

Anyways on to the question:

Will this solution work for .net 3.5? If there is a more elegant solution to this problem please feel free to elaborate.

Thanks ahead of time for your time.

+1  A: 

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
A: 

Yes actually our web app is hosted on web farm. Whether it would work on .net 3.5 is my main concern. thank you for answering so quickly

tbrownell
+1  A: 

You might want to take a look at what caused the problem in my case and how I solved it here.

ileon