【问题标题】:validation of viewstate mac failed Exceptionviewstate mac 验证失败异常
【发布时间】:2011-10-01 00:58:03
【问题描述】:

我有一个问题,我在 stack-over flow 上搜索并找到了一些答案,但没有一个对我有用:

<customErrors mode="Off" >

我必须关闭,然后我去使用我的应用程序它给了我以下一个:

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.

任何帮助都会很棒,谢谢

【问题讨论】:

    标签: asp.net viewstate web-hosting


    【解决方案1】:

    这样做会失去安全优势,但最快的解决方案是在 web.config 中设置 enableViewStateMac="false"

    <pages enableViewStateMac="false" ...>
    

    如果您的 ViewState 非常大,并且您在页面完成加载之前回发,则有时会发生这种情况。如果您使用 ViewState 作为数据存储库,这可能就是发生这种情况的原因。我还会检查您的标记并确保您没有任何未关闭的&lt;script&gt; 标签。

    【讨论】:

    • some one told me add this by an online tool that生成这个
    • 你可以试一试。只需将其添加到 system.web 部分中的某个位置,例如在 pages 部分下。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-11-27
    • 2010-11-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多