IE10 下 ASP.NET PageRequestManager、_doPostBack 未定义 解决方法


包括 FF5 关于 ASP.NET 4 ASP.NET 2.0 IE10 IE10 浏览器 文件

可以 更新 整个 机器浏览器 文件

1.文件 复制 。 \machines 文件夹复制 \Windows\Microsoft.NET\Framework\v4.0.30319\Config\Browsers 覆盖 以前版本
2. 打开 提升命令 提示符 运行 \Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regbrowsers.exe -i
3. 重新启动 IIS (例如, 带有 iisreset)

请注意 文件 . zip 文件\projects 文件夹中 那些 不同 。 \machines 文件夹。 若要 更新 单个 项目 文件复制 。 \projects zip 文件 项目 ~\App_Browsers 文件夹

尽管如此 更新 单个 项目 最简单 方法 使用 NuGet

.Net 4
PS > install-package App_BrowsersUpdate

.NET 2.0 (或者 使用 nuget.exe 命令

NuGet.exe 使用 .NET 4, 所以 如果 计算机 .NET 2, 那么 需要 手动 复制 文件

PS > install-package App_BrowsersUpdate.net20


__doPostBack error in IE10

Browser version numbers continue to march on. IE9 is here, IE10 is comingFirefox 5 and 6 are here with 7 and 8 in the wings, Opera's on 11, and Chrome is on, I dunno, somewhere between 14 and 50. Regardless, we'll all be on version 99 before The Singularity.

There is a bug in the browser definition files that shipped with .NET 2.0 and .NET 4, namely that they contain definitions for a certain range of browser versions. But the versions for some browsers (like IE 10) aren't within those ranges any more. Therefore, ASP.NET sees them as unknown browsers and defaults to a down-level definition, which has certain inconveniences, like that it does not support features like JavaScript.

If you want to see this for yourself, create a new, blank Web site (e.g. in Visual Studio 2010), add a control that requires JavaScript for postback (good example: <asp:LinkButton>), and then run the site using IE9 (where it works) and IE10 (where it won't). View the page source and compare the HTML and JavaScript sent to each browser.

A similar bug affects Firefox versions 5 and above, where support for using JavaScript to reposition the scrollbar in the browser is not detected. This basically breaks the MaintainScrollbackPositionOnPostBack property for Web Forms pages.

These "misdetection" bugs affect Web Forms pages in both ASP.NET 2 and ASP.NET 4. If you are using ASP.NET Web Pages, or if you're using ASP.NET MVC or ASP.NET Web Pages and are not using the Browser object to detect JavaScript support, you will not be affected.

FIXES

There are two ways to fix this: one is a machine-wide fix, the other is a way to fix individual sites.

MACHINE-WIDE FIXES

We're releasing a hotfix that will fix these, which you'll be able to get to via some KB articles. These KBs with fixes are live and are the best way to update your system. The fixes solve the browser-detection issue forever for all sites on a machine. These will be rolled up into future versions of the framework and will eventually also be on Windows Update.

What the fixes do is update the ie.browser and firefox.browser files in\Windows\Microsoft.NET\Framework\<version>\Config\Browsers with new and future-proofed versions of these browser definitions. Nothing else is affected.

SITE-ONLY FIXES

App_BrowsersIf you don't have access to the whole machine and/or just want to update a single project, use NuGet to install the App_BrowsersUpdate package. Your site structure in Solution Explorer will then look like the image at right. Note that NuGet uses .NET 4, so for systems that have only .NET 2, you'll need to get the ZIP file and put the new browser files in App_Browsers manually.

Updating the whole machine is the preferred way to fix this.

SUMMARY

  • ASP.NET might not recognize the most current versions of some browsers, and will consequently treat them as down-level browsers. (Basically: no JavaScript.)
  • The fix is to get updated browser-definition files.
  • You can install a machine-wide fix or just fix individual projects.

If you're interested in more detail than you need, I’ve uploaded the updated versions of firefox.browser and ie.browser files that are expected to ship with the next version of ASP.NET. The files and source is up at my BitBucket repo if you are interested in the details.



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值