Close this search box.

Resolving the “Sys is undefined” error in ASP.NET AJAX RTM under IIS 7

A plea out to all those who are using ASP.NET AJAX with sites on IIS7, either under Vista or Longhorn Server:

I’ve been battling a strange issue with ASP.NET AJAX on IIS 7 running under Vista.  It’s a site that was upgraded from RC1 to RTM, and works great under IIS 6.  Have troubleshot it enough under IIS 7 to determine that if the AppPool has the Managed Pipeline Mode set to “Integrated“, it fails, and if it’s set to “Classic“, it works perfectly.  The error I’m getting is one that was common during the beta, the Javascript error “Sys is undefined”.  This happens right after the <ScriptManager> element is parsed.

Of course I’ve checked all the standard things like making sure the System.Web.Extensions assembly is referenced, and adding this under httpHandlers:

<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

For awhile it seemed like it may be related to forms auth restricting access to the .axd script handlers, and this solution from Emad looked promising.  But after trying all manner of <location> elements in the web.config to designate the scripts to load, and even disabling forms auth altogether, it still didn’t work.

It is a site that uses master pages, so there’s all the good strangeness of Intellisense while developing in VS.  You have to have the master page open in order for Intellisense to properly show ASP.NET AJAX elements in the child page.  Perhaps the classic pipeline handles these master page scenarios properly, while the integrated pipeline does not.

I’m also wondering if this could be some kind of compression issue.  I know that IE 6.1 had issues reading compressed scripts unless you applied a hotfix, and would exhibit this problem.  But this comes up with both the patched IE6 and IE7.

I guess my next step will be to meticulously compare web.configs between a fresh project and this converted one.  Then if that doensn’t help it will be time to break out with Fiddler and see exactly what’s going across the wire.

Troubles aside, dang, ASP.NET AJAX sure is slick when it’s working!

(Edit) AHA, a solution!

Turns out in the web.config nestled under <system.webServer> / <handlers>, I was missing this entry:

<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />

Y’know, there are so danged many moving parts that can get in the way of rendering the scripts from a <ScriptManager>, I think when I have a moment I’ll write up an article to help folks troubleshoot all of them.

This article is part of the GWB Archives. Original Author: Lorin Thwaits

Related Posts