问题描述
我在 Windows 8.1 Preview 中的 IE 11 中出现空白页面.检查页面后,我认为以下代码可能是罪魁祸首,因为在这些行之后没有进一步的行显示调试器窗口,因此代码在此行之后中断.
I am getting blank page in IE 11 in Windows 8.1 Preview.After Inspecting the page I assumed that following code might be the culprit,since after these line there is not further line displayed debugger window, So code is breaking after this line.
IE 11
<!-- <form name="aspnetForm" method="post" action="Register" id="aspnetForm">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTkwNDQ3O
我在 Windows 8.1 预览版的 Chrome 版本 29.0.1547.57 m 中尝试了相同的页面它在那里工作正常,我得到以下代码.
I tried the same page in Chrome Version 29.0.1547.57 m in Windows 8.1 Preview It is working fine there and I get following code.
铬
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
-->
推荐答案
很可能您正因 IIS 上的浏览器检测问题而绊倒.Scott Hanselman 过去曾用 IE10 写过这个问题,您遇到的问题确实如此似乎反映了他的描述.
Its likely that you're tripping over an issue with the browser detection on IIS. Scott Hanselman wrote about this in the past with IE10, and the problem you're having does appear to mirror his description.
当时可用的修补程序,http://support.microsoft.com/kb/2600088,表示:
A hotfix available at the time, http://support.microsoft.com/kb/2600088, stated:
默认情况下,ASP.NET 对用户代理字符串使用嗅探技术来检测浏览器.浏览器定义文件涵盖一定范围的浏览器版本.但是,随着版本号的增加,ASP.NET 可能无法使用用户代理字符串识别浏览器的新版本.在这种情况下,ASP.NET 可能会将这些版本作为未知浏览器进行处理.例如,ASP.NET 无法识别具有以下用户代理字符串的 Windows Internet Explorer 10:
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)
但是,由于用户代理的新格式,此修补程序似乎不适用于 IE11.有一个名为 App_Browsers 的 NuGet 包可能包含修复程序,但在那之前您必须编写自己的规则.
However, this hotfix appears not to apply to IE11 due to a new format of user agent. There is a NuGet package named App_Browsers that may contain a fix, but until then you will have to write your own rule.
MSDN 浏览器定义文件架构提供有关如何编写浏览器检测文件的详细信息;您将在 C:WindowsMicrosoft.NETFrameworkv4.0.30319ConfigBrowsers 中找到现有文件.
MSDN Browser Definition File Schema gives details on how to write a browser detection file; you will find your existing files in C:WindowsMicrosoft.NETFrameworkv4.0.30319ConfigBrowsers.
根据 IE11 中的 MSDN 兼容性变化预览版,预览版中IE11的用户代理是:
According to MSDN Compatibilty Changes in IE11 Preview, the user agent for IE11 in Preview is:
Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko
标准 IE 正则表达式无法识别(因此出现了您所看到的问题),但是以下内容应该可以替代:
which is not recognised by the standard IE regex (hence the problem you're seeing), however the following should work instead:
Trident/7.0; rv:(?'version'(?'major'd+)(.(?'minor'd+)?)(?'letters'w*))(?'extra'[^)]*)
我没有在实时环境中测试过它,但这确实正确解析了主要和次要版本,这是解决原始问题的关键 - 尝试将其作为另一个匹配项添加到文件 ie.browser.
I've not tested it in a live environment, but this does parse the major and minor version correctly, which are key to solving the original problem - try adding this as another match in the file
ie.browser
.
请注意最近在 MSDN 上提出了一个类似的问题 - 可能值得关注并为此做出贡献.
Note that a similar question was asked on MSDN recently - it may be worthwhile following and contributing to that. 这篇关于doPostback 在 IE 11+ Windows 8.1 中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!