2008-12-01 183 views
1

我目前收到此错误:验证失败

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.

我发现这个错误多种解决方案。我们目前使用的解决方案是在机器级别添加静态MachineKey字段,并使用静态验证密钥和解密密钥。

<MachineKey validationKey="" decryptionKey="" validation="SHA1" decruption="AES" /> 

此解决方案是否适用于.NET 3.5?有没有更优雅的解决方案?

回答

2

您的web应用程序是否托管在webfarm中?

如果是这样,原因是服务器1呈现页面并将其发布到服务器2.因此,机器密钥不同,验证失败。

它也适用于ASP.NET 3.5。