ASP.NET Ajax客户端框架无法加载.将ScriptManager放在空白页面上

前端之家收集整理的这篇文章主要介绍了ASP.NET Ajax客户端框架无法加载.将ScriptManager放在空白页面上前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个错误Microsoft JScript运行时错误:ASP.NET Ajax客户端框架加载失败.在使用母版页的空白页上
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">

    <div>

    </div>
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="True">
    </asp:ScriptManager>
    </form>
</body>
</html>

这是它的结果

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>

</title></head>
<body>
    <form method="post" action="WebForm2.aspx" id="form1">
<div class="aspNetHidden">
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjE2OTgwNTY5ZGTfWA/dEX85PXBlbkKsVxeLKyIn+mJQ9piW5cbeNE+qww==" />
</div>

<script type="text/javascript"> 
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
    theForm = document.form1;
}
function __doPostBack(eventTarget,eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>


<script src="http://ajax.microsoft.com/ajax/4.0/2/WebForms.js" type="text/javascript"></script>


<script src="/ScriptResource.axd?d=6x_aX-LOcgUU-O_K6nM7ST5ViC_naT1e4_j-CY35ASRLpcKYpiapwTARuePHvx3llP-Xhl_AG_ubpM1BzkM5iyn9ThB3m7lmXKvkck0cxTcYiT-VbeKgamKxp9EwxBUyIQN6sSCU9SQm3tMtmzQWRg2&amp;t=ffffffffbad362a4" type="text/javascript"></script>
<script type="text/javascript"> 
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework Failed to load.');
//]]>
</script>

<script src="/ScriptResource.axd?d=khKEuZ4oUqBYvQxJ1ISpPVIW8_AWWc907q5_v74DI2ruWKTJpldq2osxPkAZ__hffe1Q6HTQUyTbL3Q1mD6MX7V65O5ibxKwb4NvN6ycdZ8vEJ-bz51MO-8uoaP2xioK6npm5n8vldI1d0sOCnH6yw2&amp;t=ffffffffbad362a4" type="text/javascript"></script>

    <div>

    </div>
    <script type="text/javascript"> 
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ScriptManager1','form1',[],90,'');
//]]>
</script>

    </form>
</body>
</html>

问题可能是我以前在我的项目中有AjaxControlToolkit,但后来我使用jquery.所以项目中的某个地方可能会尝试添加我找不到的Ajaxcontroltoolkit.我不知道如何解决这个错误.我已经尝试添加bin文件的ajaxcontroltoolkit回来,但它似乎不起作用.

解决方法

Sys undefined意味着您没有在浏览器上加载客户端文件.

解决方案1:

<add verb="GET"
  path="ScriptResource.axd"
  type="Microsoft.Web.Handlers.ScriptResourceHandler"
  validate="false"/>

解决方案2:如果没有,请在< assembly>下添加

<add assembly="Microsoft.Web.Extensions,Version=1.0.61025.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35"/>

解决方案3:如果这不起作用,请尝试从“bin”文件夹中删除文件,并重新构建解决方案并清除浏览器的缓存.

解决方案4:将其添加到您的web.config中

<location path="ScriptResource.axd">
   <system.web>
      <authorization>
         <allow users="*"/>
      </authorization>
   </system.web>
</location>
原文链接:https://www.f2er.com/aspnet/250530.html

猜你在找的asp.Net相关文章