Validation of viewstate MAC failed解决方法


网站分布在多台服务器,通过DNS轮回解析到各台服务器,

结果页面只要打开停留到DNS解析到下一个地址,就会出现出下错误信息。


 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. 
        Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
        Exception Details: System.Web.HttpException: 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.
Source Error: 
解决方法:

解决方案(1) 

在处理页面增加 
<%@ Page Language="C#"  enableViewStateMac="false" %>

解决方案(2)推荐

在web.config的<system.web>下一行添加:
<machineKey validationKey="B8CEF0C74E23E7197FCC4C9E3617C0007D94D43C7F7A79C582C54B95D69B946DFD49CAF5AA72F9A8CA2CBA040A9DF64DC1DF90DAE1214AE4F1AB7FA56DD65C0D" decryptionKey="D7F1CE31847C4FB31EF51E14F3820D52B659AF8523FC932C03506CC075DB8B28" validation="SHA1" decryption="AES" />


解决方案三


去除域名CDN解析即可