"h is not a constructor" JavaScript error using ASP.NET AJAX

This error message can have different causes. I will talk about one of them, that I found reading the ASP.net forums (Bug : Setting ScriptPath). This is the type of error that can drive someone insane.

Background information

The ScriptManager control has a property called ScriptPath which lets you specify a path to the ASP.NET AJAX JavaScript files as well as other custom scripts.

Using this, the ASP.NET AJAX files will be loaded directly from the file system, in contrast to the default, where they are loaded through an HTTP handler.

This is not only useful for debugging, but may also be necessary in specific scenarios where the HTTP Handler might give you some problems.

With this in mind, Microsoft included the JavaScript files for ASP.NET AJAX so that you can copy them to your desired folder.

Depending on your setup, these files can be usually found at:

C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\MicrosoftAjaxLibrary\System.Web.Extensions\1.0.61025.0\Globalization

You will find both debug and release (minified) versions for each JavaScript file.

The problem

It appears that using the release version of the MicrosoftAjaxTimer.js file can lead to trouble when also using a timer on a page.

In these cases, "h is not a constructor" JavaScript errors can appear and things start to fail.

The problem is in the MicrosoftAjaxTimer.js file where aparently the minification didn't go so well and a semicolon (;) was left out.

To fix this, open the file and search for the following string:


There should be a semicolon (;) before the if. Just add it, save the file and be glad that someone else found this for you (not me, congratulate the original guy in the forums)!


Nuno Freitas
Posted by Nuno Freitas on November 25, 2013

Related articles