This is a migrated thread and some comments may be shown as answers.

Error: Telerik.Web.UI.WebResource.axd and MicrosoftAjax.js

2 Answers 388 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
TonyG
Top achievements
Rank 1
TonyG asked on 20 Aug 2013, 08:34 AM
I have a web form that keeps throwing this error:

SCRIPT5007: Object expected
Telerik.Web.UI.WebResource.axd, line 6 character 51366

It shows MicrosoftAjax.js, obfuscated.
At the indicated location we see:

return function(c,d){for(var b=0,e=a.length;b<e;b++)a[b](c,d)}},

The error is on the bolded part. The element a[0] is null.

I know this isn't a Telerik issue but I'm not sure if we can manipulate the environment to get Telerik.Web.UI.WebResource.axd to load another MicrosoftAjax.js from CDN or elsewhere.

How can we diagnose this?

Only IE seems to choke on the issue. FireFox might be choking too but silently. My code is not behaving well and I'm not sure if this error has anything to do with it.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Accepted
Martin
Telerik team
answered on 23 Aug 2013, 08:08 AM
Hello TonyG,

The Telerik.Web.UI.WebResource.axd handler is used by RadScriptManager and RadStyleSheetManager components. Indeed the obfuscated code does not give much information about the cause of the issue. However, since your "code is not behaving well" I suspect that it is some of the scripts that RadScriptManager serves that does not load correctly.

You can try to detect the erroneous script by disabling the script compression (set OutputCompression=false) and script combining (EnableScriptCombine=false) of the RadScriptManager. Now the HTTP traffic to the problematic page should be much more intensive and descriptive.

Another approach would be to replace the RadScriptManager with a standard ScriptManager which does not combine or compress the files it serves.

I hope this helps.

Regards,
Martin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
TonyG
Top achievements
Rank 1
answered on 27 Aug 2013, 01:26 AM
Thanks for your response. I've had some time to look at this.
Note that OutputCompression is not a boolean, it needs to be set to "Disabled".

The initial error is:

Error: Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter name: handler

The error from ScriptResource.axd comes from this method starting on line 504:

function Sys$WebForms$PageRequestManager$add_endRequest(handler) {
    /// <summary locid="E:J#Sys.WebForms.PageRequestManager.endRequest" />
    var e = Function._validateParams(arguments, [{name: "handler", type: Function}]);
    if (e) throw e; // <<< error occurs on the throw
    this._get_eventHandlerList().addHandler("endRequest", handler);
}

OK, we have a lead. Here's my related code:
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
   <script type="text/javascript">
      Sys.WebForms.PageRequestManager.getInstance().add_endRequest(OnUIAction(null, null, 'other'));
      ...

I modified as follows and no longer see the this error.
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
  <script type="text/javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); // no args
...
    function EndRequestHandler(sender, args) {
        if (args.get_error() != undefined) {
            var errorMessage = args.get_error().message;
            showStatusCL(errorMessage); // displays msgs when in debug mode
            args.set_errorHandled(true);
            return;
        }
        OnUIAction(null, null, 'other'); // my call with args...
    }


Thanks for helping to solve this issue!
Tags
Ajax
Asked by
TonyG
Top achievements
Rank 1
Answers by
Martin
Telerik team
TonyG
Top achievements
Rank 1
Share this question
or