ASP.NET视图状态的Safari 5.x的 [英] ASP.NET Viewstate with Safari 5.x

查看:161
本文介绍了ASP.NET视图状态的Safari 5.x的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在IIS6上运行,并且有在网络配置设置本机和验证密钥的ASP.net 3.5 SP1的Web应用程序。在应用功能上正确,除了Safari浏览器所有浏览器。

I have an ASP.net 3.5 sp1 web application that is running on IIS6 and has the machine and validation keys set in the web config. The application functions correctly on all browsers except safari.

该页面加载正确,但是当进行回传我收到视图状态MAC验证失败的错误。 (另外,该应用池仅在夜间再循环每天一次,但这不应该使一个差作为密钥是固定的。)

The page loads correctly but when a postback is performed I receive a "Validation of Viewstate MAC failed" error. (Also, the app pool only recycles once a day during the night but this shouldn't make a difference as the keys are fixed.)

我发现在互联网上的一些建议,包括通过网络配置限制​​视图状态字段的大小,也禁止野生动物园内prefetch - 非其工作过

I have found several suggestions on the internet including limiting the size of the viewstate fields via the web config and also disabling Prefetch within safari - non of which have worked.

我发现#2其他职位,但他们不解决这个问题有帮助。

I have found other posts on Stackoverflow but non of them helped in resolving the issue.

这是一个已知的问题与Safari或有其他人遇到这个问题?

Is this a known issue with safari or has anyone else encountered this problem ?

推荐答案

我们对2012年3月12日这天塔Safari浏览器5.1.4发布了类似的问题开始。在Safari 5.1.5,会出现问题也是如此。它发生在Windows和Safari浏览器的Mac版。

We had a similar problem start on Mar 12, 2012 which is the day tha Safari 5.1.4 was released. The problem occurs in Safari 5.1.5 as well. It happens on both windows and mac versions of safari.

在我们的例子视图状态是通过Safari浏览器提交是一个完整的视图状态,不幸的是它是而非页面张贴的previous页。

In our case the viewstate being submit by Safari was a complete viewstate, unfortunately it was for the previous page rather than the page being posted.

要验证这一点。


  1. 首先提交前,由出现问题的页面上查看源代码检查视图状态。这通常是采用base64烯codeD和可以被加密。如果您的网站是加密的,你可能需要关闭这个功能检查的视图状态。您可以搜索互联网基地64日codeR,有几个网站,您可以在__VIEWSTATE字符串粘贴到和去code吧。

  2. 提交页面,并收到错误。如果你自定义错误的浏览器,它会告诉你,是由服务器收到的视图状态值。如果没有去应用程序了事件日志在服务器上,并找到记录的错误消息。德code作为在步骤1中也做了同样的方式在消息中的视图状态。

  3. 检查都viewstates的内容,通常你就可以通过数据来告诉视图状态是否属于页面被张贴或其他网页。

所以,如果你发现他们不同,你可能遇到我们遇到的问题。

So if you find they are different, you are probably experiencing the problem we were experiencing.

在我们的例子中违规code导致问题实际上是previous页面上。在PAGEONE我们钩住window.onload事件,并分别致电形式[0] .submit。服务器的响应是302重定向到PageTwo.aspx。在浏览器中正确通过执行Page2.aspx的GET回应。当用户pressed上PageTwo.aspx提交按钮会出现验证错误,在我们的情况下,野生动物园提交视图状态的价值为previous页,pageone.aspx

In our case the offending code that caused the problem was actually on the previous page. In PageOne we hooked in window.onload event and were calling form[0].submit. The server responded with a 302 redirect to PageTwo.aspx. The browser properly responded by performing a GET of Page2.aspx. When the user pressed the submit button on PageTwo.aspx the validation error occurs, in our case safari was submitting the value of the viewstate for the previous page, pageone.aspx

在我们的例子中,我们努力解决该问题通过调用的setTimeout(的DoWork(),10);在window.onload事件。然后把我们的code中的DoWork()函数。

In our case we worked around the problem by calling setTimeout("DoWork()",10); in the window.onload event. Then put our code in the DoWork() function.

我们已经提交了一个bug报告给苹果。

We have submitted a bug report to Apple.

希望这有助于。

这篇关于ASP.NET视图状态的Safari 5.x的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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