Tuesday, July 20, 2010

ASP.NET error: Object Expected / ScriptResource.axd

What this error means in plain English: JavaScript error.

The following case is how I solved a specific error in ASP.NET. It might give you ideas how to solve similar issues of ("Object Expected" with ScriptResource.axd). The easiest way to solve it is to use Firefox & firebug to trace down the specific JavaScript line which cause the problem.

In the scenario bellow a resource (JavaScript) could not be loaded by the browser because the clock on the computer was set back in time. This caused this problem in another JavaScript (missing definition) which caused the error message to pop-up.

Step by step how I traced down the problem:
1. When running an ASP.NET site with Menu item I got the "Object expected" error with the following information: "ScriptResource.axd". When I clicked the detailed information it gave me the URL of the resource which cause the problem.

Bottom line:
*
This error is a result of an unspecified JavaScript Error which accrued during running of a JavaScript file embedded in an ASP.NET project.
* Verify you can open the JavaScript URL using the browser.
* Debug the page using Firebug (on Firefox), see (2)

2. When opening the page in Firefox with Firebug and setting the Firebug "console" to "enabled" (with "Show JavaScript errors") it caught the following exception:
"WebForm_GetElementByTagName is not defined"

The function "WebForm_GetElementByTagName" is declared in an embedded resource called: "WebForms.js", which is in many cases the first Java script included in an HTML generated by an ASP.NET page.

Searching about this error online yielded only the following result:
http://forums.asp.net/p/1439101/3253854.aspx

Buttom line:
* Try to open in the browser each and every JavaScript include files (.AXD) in the page.

3. The error I got when I've tried to open the first ".AXD" JavaScript include file was - Parameter: "utmDate" out of range/out of date - which basically pointed me to check the computer date, since I've taken it back in time.

Setting the date forward again fixed my problem.

1 comment:

Eran Smith said...
This comment has been removed by the author.