简体   繁体   English

在IE11中,Sys.WebForms.PageRequestManager是未定义的错误,在IE10及以下版本中正常工作

[英]Sys.WebForms.PageRequestManager is undefined error in IE11, working fine in IE10 and below

My clients have updated their browser to IE11 from IE10. 我的客户已经从IE10将他们的浏览器更新为IE11。 I am getting below error on page refresh Sys.WebForms.PageRequestManager is undefined. 我在页面刷新时遇到错误Sys.WebForms.PageRequestManager未定义。

Please check my code 请检查我的代码

<asp:ScriptManager ID="scmMain" EnableCdn="false" runat="server" AsyncPostBackTimeout="0"
    ScriptMode="Release">
   </asp:ScriptManager>

<script type="text/javascript">
    Sys.Application.add_init(function () {
        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(ieAjaxPageLoaded);
        Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(ieAjaxPageLoaded);
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(ieAjaxEndRequest);
        Sys.Application.add_load(NeoSpin_PageLoad);
    });

    function header_onclick() {
    }
    function End(sender, args) { }
</script>

This works fine on IE10 and below 这适用于IE10及以下版本

I have already tried below links - but no help - 我已经尝试过以下链接 - 但没有帮助 -

'Sys.WebForms.PageRequestManager' is null or not an object 'Sys.WebForms.PageRequestManager'为null或不是对象

Microsoft JScript runtime error: 'Sys' is undefined Microsoft JScript运行时错误:'Sys'未定义

http://encosia.com/updated-your-webconfig-but-sys-is-still-undefined/ http://encosia.com/updated-your-webconfig-but-sys-is-still-undefined/

http://www.codeproject.com/Questions/543002/Unableplustoplusgetpluspropertyplus-27PageRequestM http://www.codeproject.com/Questions/543002/Unableplustoplusgetpluspropertyplus-27PageRequestM

Thanks Fahad Mullaji 谢谢Fahad Mullaji

So I don't have a solution for you, but here is what I think is going on based on my experience with my Server compared to my local development machine. 所以我没有为您提供解决方案,但根据我与本地开发机器相比的服务器经验,我认为这是正在进行的。 It looks like you are using the ASP.NET control toolkit, which was sort of deprecated a few years back and should be available as an open source project on Codeplex now. 看起来您正在使用ASP.NET控件工具包,这种工具包在几年前就被弃用了,现在可以在Codeplex上作为开源项目使用。 It is primarily driven from the server-side and I am betting it is doing some poor browser sniffing since that was a common thing to do back then. 它主要是从服务器端驱动的,我打赌它正在做一些糟糕的浏览器嗅探,因为这是当时常见的事情。 What it should do is feature detection. 它应该做的是特征检测。

So where does the problem come from? 那问题从何而来? So my local dev machine reports IE 11 as majorVersion == 11. My server reports majorVersion as 7. So there really needs to be a patch to fix the server, but I am not sure if it exists yet. 所以我的本地开发机器将IE 11报告为majorVersion == 11.我的服务器将majorVersion报告为7.所以确实需要一个补丁来修复服务器,但我不确定它是否存在。 The other option is to go patch the control toolkit to NOT browser sniff and feature detect instead. 另一个选择是将控制工具包修改为NOT浏览器嗅探和功能检测。 That is a very daunting task to say the least. 至少可以说,这是一项非常艰巨的任务。

Just 2 cents worth on the topic though. 虽然这个话题只值2美分。 This is a real concern because I am guessing this issue might actually keep your company or client from actually updating their systems, which eventually will catch up to them and cause them major issues, like not upgrading XP machines by April is going to cause a lot of companies. 这是一个真正的问题,因为我猜这个问题实际上可能会让你的公司或客户实际更新他们的系统,最终会赶上他们并导致他们出现重大问题,比如在4月份之前不升级XP机器会导致很多公司

Sorry I do not have a solution for you, but this is very interesting as I am doing research on issues that need to be resolved to help companies get off obsolete platforms like old IE & XP right now. 对不起,我没有为您提供解决方案,但这非常有趣,因为我正在研究需要解决的问题,以帮助公司立即摆脱旧的IE和XP等过时的平台。

The problem is with the userAgent string sent by IE 11 where Dot Net 4.0 frameworks or below do not recognize as Internet Explorer. 问题在于IE 11发送的userAgent字符串,其中Dot Net 4.0框架或以下不能识别为Internet Explorer。 You can fix this problem either by upgrading your server to Dot Net 4.5 or you can add add an ie.Browser file in your web application within the folder App_Browsers with the following entry 您可以通过将服务器升级到Dot Net 4.5来解决此问题,也可以在App_Browsers文件夹中的Web应用程序中添加一个ie.Browser文件,其中包含以下条目

<browser id="InternetExplorer" parentID="Mozilla">
    <identification>
        <userAgent match="Trident/(?'layoutVersion'[7-9]|0*[1-9]\d+)(\.\d+)?;(.*;)?\s*rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)))" />
        <userAgent nonMatch="IEMobile" />
        <userAgent nonMatch="MSIE " />
    </identification>

    <capabilities>
        <capability name="browser"              value="InternetExplorer" />
        <capability name="version"              value="${version}" />
        <capability name="majorversion"         value="${major}" />
        <capability name="minorversion"         value="${minor}" />
        <capability name="layoutEngine"         value="Trident" />
        <capability name="layoutEngineVersion"  value="${layoutVersion}" />
        <capability name="type"                 value="InternetExplorer${major}" />
    </capabilities>
</browser>

This seems to be an known issues as the framework is not able to detect IE 11 as Microsoft Internet Explorer. 这似乎是一个已知的问题,因为框架无法将IE 11检测为Microsoft Internet Explorer。 You can download the patch from following link to resolve the problem. 您可以从以下链接下载修补程序以解决问题。

Click here to Download patch from Microsoft site 单击此处从Microsoft站点下载修补程序

Or following:

<head>
<meta http-equiv="X-UA-Compatible" content="IE=10" />
</head>

Finally found solution to this problem. 终于找到了解决这个问题的方法 I upgraded .NET version from 4.0 to 4.5. 我将.NET版本从4.0升级到4.5。 I don't know how it internally works. 我不知道它是如何在内部工作的。

Thanks 谢谢

the references config file from Liran will work but only if Mozilla has javascript enabled. 来自Liran的引用配置文件将起作用,但前提是Mozilla已启用javascript。 .Net 4.0 didn't have javascript enabled for Mozilla. .Net 4.0没有为Mozilla启用javascript。 This is from the default.browser file from a server with .Net 4.5: 这来自具有.Net 4.5的服务器的default.browser文件:

<browser id="Mozilla" parentID="Default">
    <identification>
        <userAgent match="Mozilla" />
    </identification>
    <capture>
    </capture>
    <capabilities>
        <capability name="javascript" value="true" />
  • then run aspnet_regbrowsers.exe because browser files don't actually do anything until you run that. 然后运行aspnet_regbrowsers.exe,因为浏览器文件实际上并没有做任何事情,直到你运行它。
  • If you're using a App_Browsers folder in your project you'll also need to delete your temporary internet files (mine was in C:\\Windows\\Microsoft.NET\\Framework64\\v4.0.30319\\Temporary ASP.NET Files but your results may vary of course). 如果你在项目中使用App_Browsers文件夹,你还需要删除你的临时互联网文件(我的是在C:\\ Windows \\ Microsoft.NET \\ Framework64 \\ v4.0.30319 \\ Temporary ASP.NET Files,但你的结果可能是当然不一样)。 You have to delete it because ASPNet needs to regenerate a dynamic DLL it generates from your App_Browsers/*.browser files. 您必须删除它,因为ASPNet需要重新生成它从App_Browsers / *。浏览器文件生成的动态DLL。

Of course the easiest way is just install .Net 4.5. 当然最简单的方法就是安装.Net 4.5。 This answer is only applicable to people who can't for some reason. 这个答案仅适用于因某些原因不能的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM