在“/”应用视图状态MAC失败 - 服务器错误的验证 [英] Validation of viewstate MAC failed- Server Error in '/' Application

查看:117
本文介绍了在“/”应用视图状态MAC失败 - 服务器错误的验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误,当我访问我的托管Web应用程序(在VS2008 C#ASP.NET 3.5框架)

I got this error when i access my hosted web application(in VS2008 C# ASP.NET 3.5 Framework)

视图状态MAC验证失败。如果此应用程序由Web场或群集承载,确保配置指定了相同的validationKey和验证算法。自动生成不能在集群中使用。

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.

有趣的是,有没有问题,如果我们登录过程后继续进行。如果你登录和15或20分钟什么都不做,然后单击任意菜单......会产生这个错误。所以我怀疑它是与会话了。在我的webconfig文件我已经写了会话超时如下:

The interesting thing is that there is no problem if we continue after login process. If you logged in and do nothing for 15 or 20 minutes, then click any menu...this error will be generated. So I doubt that it is related to session out. In my webconfig file I have written session time out as follows.

<sessionState timeout="15" />

我怎样才能纠正这个错误?

How can I correct this error?

推荐答案

有几种方法来解决这个问题,但一些解决方案是比别人做得更好。最快的方法通常是添加以下到的web.config

There are a few ways to fix this issue, but some solutions are better than others. The fastest way is usually to add the following to the web.config:

<pages enableEventValidation="false" viewStateEncryptionMode="Never">

与上述解决方案的问题是,你牺牲一些安全性。接下来的速战速决是添加以下到的web.config ,但也有缺点,这也:

<pages enableViewStateMac="false">

如果该应用程序由Web场托管或跨多个Web服务器另有分布,你应该避开该选项。

If this application is hosted by a web farm or is otherwise distributed across multiple web servers, you should probably steer clear of that option.

在我看来,最好的整体解决方案是提供<一个href=\"http://adam.kahtava.com/journal/2009/11/23/how-to-fix-the-validation-of-viewstate-mac-failed-error-aspnet-mvc/\">here.

In my opinion, the best overall solution is offered here.

这篇关于在“/”应用视图状态MAC失败 - 服务器错误的验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆