ASP.NET Ajax client-side framework failed to load. when put the ScriptManager on a blank page

I have an error Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load. on a blank page using masterpage

enter image description here

<!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>

This is what it render it the end
<!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="https://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>

The problems might be that i used to have AjaxControlToolkit in my project but later i use jquery instead. so somewhere in the project might try to add Ajaxcontroltoolkit which i can’t find it. i don’t know how to fix this error. i have tried to add bin file of ajaxcontroltoolkit back but it seems to not work.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

this solution works for me:

The error on client was:

SCRIPT5022: ASP.NET Ajax client-side framework failed to load.

SCRIPT5009: ‘Sys’ is undefined

After many time to mining the websites, and more solutions, i solve the problem:

the solution for .NET 4.0 is:

Set EnableCdn property of script manager to true, Like this:

<asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true">

Next Solution and Better Solution is:

add this handler to your web.config

  <system.webServer>
    <handlers>
      <remove name="WebServiceHandlerFactory-Integrated"/>
      <remove name="ScriptHandlerFactory"/>
      <remove name="ScriptHandlerFactoryAppServices"/>
      <remove name="ScriptResource"/>
      <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </handlers>
  </system.webServer>

Method 2

Sys undefined means that you’re not getting the client side files loaded on your browser.

Solution 1:

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

Solution 2: If you don’t have this, add this too under <assemblies>
<add assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

Solution3: If that doesn’t work too, try deleting files from your “bin” folder and rebuild the solution and clear the cache of your browser.

Solution 4: Add this to your web.config

<location path="ScriptResource.axd">
   <system.web>
      <authorization>
         <allow users="*"/>
      </authorization>
   </system.web>
</location>

Method 3

for telerik web resources use this code:

<location path="Telerik.Web.UI.WebResource.axd">
<system.web>
  <authorization>
    <allow users="*"/>
  </authorization>
</system.web>

Method 4

I had enabled WebForms Routing and forgot to add the exception for resources:

routes.Ignore("{resource}.axd/{*pathInfo}");

Method 5

Another possible cause is script combining/compression in IE 8 & 9. In web.config at the top level (within Configuration), put

 <system.web.extensions>
       <scripting>
             <scriptResourceHandler enableCompression="false" enableCaching="true" />
    </scripting>
</system.web.extensions>

On your ToolKitScriptManager put CombineScripts=False, e.g.
<asp:ToolkitScriptManager runat="server" CombineScripts="False">
</asp:ToolkitScriptManager>

see http://robmzd.blogspot.com/2010/02/invalid-character-error.html which is where I figured out the problem

Method 6

I had this problem when I moved my forms to a new server. I spent hours to find the solution.
The problem was that the new server has ASP.NET 4.0 and my web.config was ASP.NET 3.5. So I made a new web.config and everything is ok now.

Method 7

Simply add the <handlers> section as shown below in your web.config within <system.webServer> and this will fix the problem in no time.

<system.webServer>
.
.
.
<handlers>
  <remove name="WebServiceHandlerFactory-Integrated"/>
  <remove name="ScriptHandlerFactory"/>
  <remove name="ScriptHandlerFactoryAppServices"/>
  <remove name="ScriptResource"/>
  <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  <add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>

Method 8

For me it was the problem with Global.asax code,

Just check below condition before validating session in Application_PreRequestHandlerExecute

Request.Path.ToUpper() != Constants.AliasName.ToUpper() + "SCRIPTRESOURCE.AXD"

Functional code is shown below,
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
        {
            if ((Request.Path != Constants.DebugLoginUrl) &&
                (Request.Path != Constants.SessionTimeOut) &&
                (Request.Path.ToUpper() != Constants.AliasName.ToUpper() + "TRACE.AXD") && 
                (Request.Path.ToUpper() != Constants.AliasName.ToUpper() + "SCRIPTRESOURCE.AXD"))
            {
                // to prevent check of HTTP HANDLER FLUSH - Session State is Invalid
                if (HttpContext.Current.Session != null)
                {
                    if (Session[Constants.personId] == null)
                    {
                    //your code
                    }

                else
                {
                    Response.Redirect(Constants.SessionTimeOut);
                }
            }
        }

Method 9

In my case the Ajax loading error occurred only if I reloaded the page, not when the page was loaded for the first time.

Looking at the content in the tag in Site.Master, I noticed that only some of the items had Path attribute set. So, I updated MsAjaxBundle to this: and the problem went away. I also had to modify the WebFormsBundle the same way and now reloading the page works.

Method 10

What worked for me was to download ASP.NET Ajax from Microsoft.

You might also need to explicitly browse for the correct dll version when you add reference e.g.

C:Program Files (x86)Reference AssembliesMicrosoftFramework.NETFrameworkv4.5.1System.Web.Extensions.dll

Method 11

I set Application Pool as ASP.NET 4.0 Classic during installation.

Method 12

well i just changed RadScriptManger to Simple asp:ScriptManager and it works

Before:

<telerik:RadScriptManager ID="RadScriptManager1" EnableCdn="true" runat="server" />

After
<asp:ScriptManager ID="scrReg" EnablePartialRendering="true" runat="server"></asp:ScriptManager>

Hope it helps

Method 13

Add EnableScriptCombine=”False” to your RadScriptManager as follows:

<telerik:RadScriptManager ID="RadScriptManager1" EnableScriptCombine="False" runat="server" />

Method 14

And here’s another cause. I installed MySQL Connector/net 6.9.5. Later I started getting the dreaded ‘sys undefined’ for everything in some, but not all, projects in IE. Many, many hours later I tried Chrome and Opera and the first page opened fine but on post back all the session variables had vanished. That’s when the penny finally dropped – Connector/net must have set itself up the session state provider but I had nothing for session state in web.config for the failing projects. Sessionstate inproc fixed it immediately. At least I think that’s what happened…

Method 15

In my case, I had ended up with the mentioned handlers in <httpHandlers> as well as in <handlers>.
Removing the <httpHandlers> section fixed it.

Method 16

After adding System.Web.MVC reference to my ASP.NET and added default route in global.asax
i.e.

RouteTable.Routes.MapRoute("Default", "{controller}/{action}/{id}",
                                       new { controller = "new", action = "Index", id = "" });
        }

Started getting the error

Added below line to global.asax.cs to resolve it

  RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

Method 17

For anyone working with the Visual Studio 2015 ASP.NET 4.5 WebForms Web Application project template which bundles the ASP.NET AJAX scripts:

https://stackoverflow.com/a/47673606/313935

Method 18

for me web config was correct.
if web config is correct then.
check your IIS App pool settings in my case App pool pipeline was selected as the classic I made pipeline integrated and it started working.

Go to iis -> rightclick on your application pool -> advance settings ->
Managed Pipelined Mode -> “integrated” -> ok

Method 19

I am using Visual Studio 2015 ASP.NET 4.5 Web Forms Web Application project and apparently a bad route in an API Controller will also cause this error. I fixed the route and the error went away.
It certainly would be nice for a more descriptive error message as to why the client framework won’t load. I spent hours checking web.config settings, clearing the .net temporary directories, checking global.ascx, etc.. The strange thing is while IE 11 died while loading default.aspx, chrome was able to load default.aspx and the web site.

Method 20

Try changing on the web.config the compilation to false:

<compilation debug="false" targetFramework="4.5">

Method 21

If none of these answers work for you then you might be in my situation.
Ok, so for me the issue was caused by the ssl certificate expiring today, so after I renewed it then these errors went away.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x