我有3个.aspx文件。例如

GrandFather.aspx, Father.aspx and Child.aspx


GrandFather.aspx页面上有一个iframe,而iframe的源是Father.aspx。形式为Father.aspx,我通过使用调用了Child.aspx

Resposne.Redirect("Child.aspx");


因此,iframe内容已通过Child.aspx进行了更改。现在,Child.aspx具有一些在回发中提交的表单数据。浏览器IE,FireFox和Google Chrome浏览器均已正常运行,但在Safari中显示以下错误,

System.Web.HttpException: A field validation of viewstate MAC. If a Web Farm
or cluster is hosted by this application, please check that you have to specify
the configuration is the same validationKey and validation algorithm <machineKey>.
AutoGenerate can not be used in the cluster.


这个问题背后的原因可能是什么?我该如何解决?

我检查了iframe的来源,即使在Response.Redirect之后,它也始终显示Father.aspx。

我正在使用.NET 2.0,而IIS是6.0。

编辑:

第一次回发,Safari浏览器显示该错误。但是,对于下一次尝试,错误消失了。

最佳答案

我的公司最近遇到了Safari + IFrame + Cookies的问题。
基本上,Safari首次加载Iframe时不接受任何Cookie。当然,这会造成各种破坏,从而导致所有身份验证和会话无法正常工作。

Here is a related question that has to deal with Same-Origin-Policy
它表示,一旦用户与iframe页面进行了交互,Safari便会正常运行。他们提出了一种解决方法,即使用JavaScript POST空表单,而Safari实际上考虑了这种“用户交互”。页面刷新后,Safari将随后正常运行。

我们的解决方案是为Safari用户简单地突破Iframe。这不是理想的解决方案,而是我们真正需要的。

关于c# - Iframe中的回发导致Safari浏览器中的Viewstate MAC错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7976891/

10-12 12:43
查看更多