views:

158

answers:

1

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,
    ...
    126�=NCys.UI.�ey.ra�isterEnum("Sn2.UI.Key");

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?

+1  A: 

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.

inked
Thanks - Added more details. It was resolved by setting web.config to release mode. Any ideas as to how to fix this ?
kiev
I tend to write my own AJAX patterns and have avoided custom controls since VB6 for the very problem you're encountering: I don't know what some other programmer might have jammed into that custom code so when it crashes, I don't want to be left without a solution. At least if its my code, I can read the notes I left for myself in the comments. I'll poke around though. Debug vs Release is triggering some long forgotten memory.
inked