‘Sys’ is undefined

Written by Yves

May 28, 2007

Preparing a presentation about AJAX and a comparison between the Microsoft world and the other (basically the rest of the world…), I went to an issue I did not expect, because I thought it would be more automatic.


When you add a ScriptManager and an UpdatePanel to a web page, the first times you will run the application, there are chances that the “‘Sys’ is undefined” Javascript error occurs. Not only the Javascript error is shown, but when you click on, let say a button in your UpdatePanel, this will post the page back to the server, updating the whole page.


This is because in the HTML code, the Sys.Application.Initialze function is called close to the end of the code. The problem is that the resource files containing the Javascript code are coming and downloaded from the server using a .axd file (ScriptResource.axd, more precisely).


To fix this issue, the line below has to be added in the web.config file under the <httpHandlers> section :


<add verb=”GET,HEAD” path=”ScriptResource.axd” type=”System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ validate=”false” />

You May Also Like…

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *