视图状态MAC的Asp.net验证失败

问题描述:

我收到的asp.net网站在某些时候下面的错误。

I am receiving the following error at certain times on asp.net website.

 Sys.WebForms.PageRequestManagerServerErrorException: 
 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.

在页面刷新的推移,没有problem.How我能解决这个问题?

When page refresh goes,no problem.How can I solve this problem?

如果您使用的是Web场并运行在多台计算机相同的应用程序,你需要在machine.config文件中明确定义了计算机密钥:

If you're using a web farm and running the same application on multiple computers, you need to define the machine key explicitly in the machine.config file:

<machineKey validationKey="JFDSGOIEURTJKTREKOIRUWTKLRJTKUROIUFLKSIOSUGOIFDS..." decryptionKey="KAJDFOIAUOILKER534095U43098435H43OI5098479854" validation="SHA1" />

把它下的&LT;的System.Web方式&gt; 标签

有机器code中的自动生成,不能使用。生成自己的machineKey看到这个PowerShell脚本:
http://support.microsoft.com/kb/2915218#AppendixA

The AutoGenerate for the machine code can not be used. To generate your own machineKey see this powershell script: http://support.microsoft.com/kb/2915218#AppendixA