AKA Marketing.com Logo            VISIT THE BLOG            

Blogged thoughts, is our web blog. Expect views, opinion, rants and tirades about everything and anything 

« Home / Forums »        


Subscribe to our SEO / IT related blog by entering your email address below

Blogged thoughts

| by the www.akamarketing.com team

ASP.NET AJAX 3.5 error - “Sys is undefined” workaround

I was trying to put together a prototype for a potential client but kept on getting a ‘Sys is undefined’ AJAX error when I tried to run it on my host Blacknight.ie, however when I ran it on another host - discountasp.net everything worked fine. It also worked fine on my local development machine which consists of Visual Web Developer 2008 SP1 and .Net 3.5 SP1.

There’s an absolute tonne of blog posts and forum threads on this topic but I couldn’t find an exact fix. Things like modifying the web.config are most often mentioned but that ‘fix’ usually relates to environments targeting .Net 2.0 (before AJAX was included a part of the framework core).

One blog post that did point me in the right direction was:


It turns out that the ‘Sys is undefined’ error most likely occurs because the actual Javascript functions which power AJAX are inaccessbile to your .aspx pages for some reason. As suggested in that post I looked through my IIS logs to see if ScriptResource.axd was being found as that is the file that is required to ‘inject’ JS into AJAX enabled pages. It was not being found as the IIS log line below shows :

2009-03-02 08:27:54 GET /ScriptResource.axd HTTP/1.1 Mozilla/5.0+(Windows;+U;+Windows+NT+6.0;+en-GB;+rv: http://d1004190.blacknight.com/davetest.com/ajaxtest d1004190.blacknight.com 404 0 1741

The reason for this can apparently be a number of things including bad web.config configuration, bad IIS configuration and incorrect assemblies (mismatch between expected versions & actual versions) in the GAC. I’m pretty sure it’s a blacknight configuration issue though due to the fact it worked on my local machine and on discountasp.net. I’ve sent Blacknight the above link anyhow so watch this space.

What is the Sys is undefined workaround then?
AJAX is as many of you surely know just really javascript and thus ‘under the hood’ Microsofts AJAX implementation is just really Javascript. Knowing that non ASP.Net developers might want to get their hands on a good AJAX framework Microsoft has made their framework (basically a load of .js files) available from their AJAX downloads page.

These can be used by .Net developers in conjuction with the scriptpath property of the scriptmanager control on your page to allow you to remove dependency on your server and actually include the JS code required to run controls like UpdatePanel, Timer etc. with your regular Javascript stuff. This is what I did and it worked fine on the local machine (surprise, surprise) but still on Blacknight the JS source wasn’t being found. I examined the source code of my page on Blacknight and the src tag that was outputted was:

<script src=”MicrosoftAjaxLibrary/System.Web.Extensions/” type=”text/javascript”></script>

However the version of the library available from the downloads page mentioned above is 3.5.30729.1. I renamed the version on the host to 3.5.21022.8 (better to download the right library of course), refreshed and it worked perfectly from then on. Interesting the src tag outputted from my local machine correctly referenced library version 3.5.30729.1.

Why does the framework on blacknight look for version 3.5.21022.8 but discountasp.net and my local environment look for 3.5.30729.1?. I’m not 100% certain but machines with 3.5 sp1 (discountasp.net & local machine) must be configured to ‘look’ for an AJAX library of a particular version, while machines of 2.0 or 3.5 will look for other versions. This means in theory a mismatch between what version of the AJAX library (well what version of the containing assembly - ‘System.Web.Extensions’ to be more correct) the framework expects and what version it finds (or doesn’t find for that matter).

To check if there’s a mismatch you could set the scriptpath property of the scriptmanager to some abitary value, upload, check the src statement which will look similar to the one above to see the expected version of the System.Web.Extensions assembly you need and then you could use reflection to check the actual version you have… of course I’m not certain on any of this mismatch business, casual theory only. 

What I do know however is that ‘Sys is udefined’ basically means that for whatever reason javascript code required to ‘run’ AJAX is missing, so if you cause .net to reference it in the traditional way (ie. .js files in your www folder) by using the scriptpath property it appears to be a fairly solid workaround.

3 Comments on “ASP.NET AJAX 3.5 error - “Sys is undefined” workaround”
1| David Callan said,

Got this resolved fully, Tara from Blacknight helped me out on it. The problem in this instance was not to do with assembly versions but rather due to the fact that I was using a temporary URL which messed things up IIS wise internally. Resolution was to use a host file and configure my sites IP for some domain name. I only really using Blacknight at the moment for demoing stuff but will be getting a throwaway .com over the next few days anyhow.

Still that sys is undefined error is a bugger.

2| hvac said,

Thanks David, your workraround works for me.

3| xinqikan said,

Got this resolved fully

Leave a Comment
12 Lorcan Crescent, Santry, Dublin 9, Ireland +353 87 9807629