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

3 posts, 1 answers
  1. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 20 Aug 2013 Link to this post

    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. Answer
    Martin
    Admin
    Martin avatar
    811 posts

    Posted 23 Aug 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. TonyG
    TonyG avatar
    239 posts
    Member since:
    Feb 2006

    Posted 26 Aug 2013 Link to this post

    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!
Back to Top