Wednesday, July 25, 2012
Old version of Ajax Control Toolkit causes "strict mode" error
My .NET website was working fine in IE, Chrome and Firefox. Then one page stopped working in Chrome and Firefox, while continuing to be okay in IE. Since I didn't change the website, I assume upgrades to Chrome and Firefox introduced the problem.
The problem was on a page that uses Ajax Control Toolkit to create an UpdatePanel to update just a portion of the page. That portion of the page was no longer being displayed. In other words, a big chunk of the user interface was missing.
In Chrome's JavaScript console, I found an error message, "Illegal access to a strict mode caller function." In Firefox's error console, I found a similar error message, "access to strict mode caller function is censored."
Some Google searching indicated this error has to do with ECMAScript 5's strict mode. However, nowhere in my Visual Studio solution was there any explicit reference to "use strict." So I figured the problem must be in Microsoft's generated code or a third-party vendor's code.
I could tell from the Chrome JavaScript console that the error occurred in line 5 of ScriptResource.axd. This line begins with Type._registerScript("MicrosoftAjaxWebForms.js"...
This was a good hint that the problem might be in the Ajax Control Toolkit. In my Visual Studio 2010 web application project, I upgraded the Ajax Control Toolkit from version 2.x to the latest version, 4.1.60623.0. I did so by expanding the projects References folder, deleted AjaxControlToolkit, then using nuget to add the Ajax Control Toolkit to the solution and apply it to the affected project.
This fixed the problem.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment