I have an asp.net form that contains some html, 2 controls a calendar from the AjaxControlToolkit and a custom SandTrap.WebControls textbox which works fine on several other servers we have this form running on. However on one server It breaks and when I debug the javascript It seems I have a corrupt MicrosoftAjax.js being downloaded - it says unexpected token illegal

Here is what is coming through inside MicrosoftAjax.js line 2932

Sys.UI.Key.prototype = {
    backspace: 8,
    tab: 9,
    enter: 13,
    esc: 27,

First thing I did is compare the website directory with the other servers - same. Checked that the MicrosoftAjax.js is not corrupt. Everything is identical. So what could this be?

Edit: the culprit is ajaxToolkit:ToolkitScriptManager for sure. When I removed it, the page loads fine. I did a compare on the MicrosoftAjax.js and nothing different is coming up. I even replaced the file with another one from my pc still no luck.

Edit: Seems that if I set debug to false in the web.config the error goes away. Any other ideas as to what could be causing this? I looked at the .debug js file and it looks fine.

Would reinstalling the ajaxtoolkit somehow help? Or do I need to reinstall the .net framework?

Accepted Answer

Open Notepad, place the code in there, then save it back (making sure it's not saving Unicode). Someone might have opened it and saved it with Wordpad or some word processor. So, visually, things might "look" right, but they won't be.

You could also run a COMP against a known good file and your bad file. Or just copy a known good file over the bad file

Humans are the least trustworthy elements in the computing process.

Written by inked
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki