Thursday 29 March 2012

ASP.NET Ajax client-side framework failed to load And\Or 'Sys' is undefined

My ASP.NET application with AJAX controls suddenly started giving script errors in IE8, but it worked perfectly alright in Chrome and Firefox.

Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load.
Microsoft JScript runtime error: 'Sys' is undefined


The error was as below in VS.


 In IE8, you can notice the error at left corner of status bar.

Spent 2 days, tried all different option including

a) Modifying web.config
b) Enabling Javascript in IE
c) Restoring IE default settings
d) Removing and adding AjaxControlToolkit.dll in VS2008.
e) Adding axd extension in IIS.

But no luck. I even created new web application with one page and one AJAX control, the same error appeared when i hit F5 in VS2008. But i browse the page in Chrome or Firefox it worked like charm. That concluded me there was nothing wrong in my app.
Exisiting applications hosted in different server showed script error in my IE8 window but worked on others machine.

Atlast, found the solution at http://stackoverflow.com/a/8522460, thanks to Chris Hammond.

Solution is, this could be a caching/compression issue and by putting in the following into Web.Config, resolves the issue.

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