Troubleshooting the "'Sys' is Undefined" Error When Using AJAX Extensions for ASP.NET

If you've put together some ASP.NET code that uses some of the AJAX extensions, but the code doesn't work and you get a client script error that states "'Sys' is undefined", you're not alone. I've experienced this error myself, and none of the stuff I found on the web concerning the error helped me out any. But I was able to resolve the problem, and here's how: I added the following lines to the httpHandlers section of my web.config file.

<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>

This did the trick for me. If this still doesn't help you out, try creating a new AJAX-Enabled website and copying anything from it's web.config file that isn't in your existing web.config.

UPDATE: If you're getting this error (or the similar "Sys is not defined") in your client-side code, check out this post.

Comments

Anonymous said…
Thank you so much. It really helps get rid of this uber annoying problem. But just to make it more clear, here is the place you have to put in...

system.web
httpHandlers
....the code here....
/httpHandlers
/system.web

Popular posts from this blog

How To Mock Out Child Components In Unit Tests of Angular 2 Code

A Generic Method Using HttpClient to Make a Synchronous Get Request

The Cause and Solution for the "System.Runtime.Serialization.InvalidDataContractException: Type 'System.Threading.Tasks.Task`1[YourTypeHere]' cannot be serialized." Exception