.NET 4 上的 ASP.NET 导致 IE11 throw _doPostBack is undefined javascript 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19783852/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 16:46:10  来源:igfitidea点击:

ASP.NET on .NET 4 causing IE11 throw _doPostBack is undefined javascript error

javascriptasp.net.netpostbackinternet-explorer-11

提问by frogcoder

Edit: The site is on Windows Server 2003, hence cannot be upgraded to .NET framework 4.5.

编辑:该站点在 Windows Server 2003 上,因此无法升级到 .NET Framework 4.5。

Our web site is serving ASP.NET ON .NET 4. When using IE 11 the auto postback stopped working with the error "_doPostBack is undefined". It's very likely can be fixed with some modification to the browser definition file, which I don't know how yet.

我们的网站在 .NET 4 上提供 ASP.NET。当使用 IE 11 时,自动回发停止工作,出现错误“_doPostBack 未定义”。它很可能可以通过对浏览器定义文件进行一些修改来修复,我还不知道如何修改。

Microsoft suggests feature detection (preferred), or changing the browser definition file. http://msdn.microsoft.com/en-us/library/IE/hh869299%28v=vs.85%29.aspx

Microsoft 建议功能检测(首选),或更改浏览器定义文件。 http://msdn.microsoft.com/en-us/library/IE/hh869299%28v=vs.85%29.aspx

It looks like feature detection means dropping auto postback all together. Isn't that just like rewriting the whole site?

看起来特征检测意味着一起放弃自动回发。这不就像重写整个网站一样吗?

Can someone describe how to accomplish both feature detection and browser definition file modification? Which way is preferred and why.

有人可以描述如何同时完成特征检测和浏览器定义文件修改吗?哪种方式是首选,为什么。

The accepted answer solved the problem, seems like it's the only way if you are stuck on server 2003. It would be really really nice if someone could explain how feature detection could be done without massive code changes.

接受的答案解决了这个问题,如果你被困在服务器 2003 上,这似乎是唯一的方法。如果有人能解释如何在没有大量代码更改的情况下完成功能检测,那将是非常好的。

采纳答案by Jiayun Zhou

It seems that Windows Server 2003 needs a server-wide solution and all hotfixes didn't work, so it must be done manually.

Windows Server 2003 似乎需要一个服务器范围的解决方案,并且所有修补程序都不起作用,因此必须手动完成。

  1. Edit C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\Browsers and add the browser definition in this answer https://stackoverflow.com/a/19203518/1297563
  2. Run c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regbrowsers.exe -i
  3. Restart IIS
  1. 编辑 C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\Browsers 并在此答案中添加浏览器定义https://stackoverflow.com/a/19203518/1297563
  2. 运行 c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regbrowsers.exe -i
  3. 重启 IIS

回答by Karl Glennon

Upgrade your .NET Framework to 4.5

将您的 .NET Framework 升级到 4.5

Once installed run the command:

安装后运行命令:

aspnet_regbrowsers -i

回答by TryingToCode

@FrogCoder

@FrogCoder

I came across this problem yesterday - and the patch 2836939 solved my issue. Windows 8.1 IE11.

我昨天遇到了这个问题 - 补丁 2836939 解决了我的问题。Windows 8.1 IE11。

Please consider the following from the Hotfix URL:

请考虑 Hotfix URL 中的以下内容:

"Note If you run the ASP.NET browser registration tool (Aspnet_regbrowsers.exe) after you install the update, the old behavior will return."

“注意如果您在安装更新后运行 ASP.NET 浏览器注册工具 (Aspnet_regbrowsers.exe),旧行为将返回。”

http://support.microsoft.com/kb/2836939

http://support.microsoft.com/kb/2836939

Hope this helps.

希望这可以帮助。

回答by vishal

Place below script in your master page will fix it. i had a similar issue and got fixed.

在您的母版页中放置以下脚本将修复它。我有一个类似的问题并得到解决。

<script runat="server">

protected override void OnInit(EventArgs e)
{
Page.ClientTarget = "uplevel";
base.OnInit(e);

}
</script>