(Ajax) Loading a web service after async postback

Discussion in 'ASP .Net' started by elado7@gmail.com, Oct 15, 2007.

  1. Guest

    Hey

    I'm trying to load a webservice after an async postback in the
    following way:

    ScriptManager.GetCurrent(Page).Services.Add(new
    ServiceReference("WS.asmx"));

    in order to have a client-side access to its web methods.

    When doing it with normal postback or in the first load of the page,
    it works, but if I load it manually from within a code after an async
    postback, the code doesn't appear to download to the browser.
    I load if from the code since it comes from a dynamically loaded user
    control (ascx loaded thru Page.LoadControl).

    So, I tried to load it like a javascript include in the following way:

    ScriptManager.RegisterClientScriptInclude(Page,Page.GetType(),"key","file.asmx/
    js");

    However, since the source is missing the
    'Sys.Application.notifyScriptLoaded()' call, the ajax framework yelled
    at me :
    Microsoft JScript runtime error: Sys.ScriptLoadFailedException:
    The script '...' failed to load. Check for:
    Inaccessible path. Script errors. (IE) Enable 'Display a
    notification about every script error' under advanced settings.
    Missing call to Sys.Application.notifyScriptLoaded().

    So, finally I tried to load the script's content and register it as a
    script block. Bah. The asmx is protected thru authorization.

    My solution could be allowing anonymous access to the asmx, or make a
    js function that'll document.createElement a script and inject it to
    the <head>, and register it as a script block.
    But I'm asking -- isn't there any other clean way? Can't I just
    disable the notifyScriptLoaded?

    Thanks
    Elad
     
    , Oct 15, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tg
    Replies:
    0
    Views:
    662
  2. Not Me
    Replies:
    1
    Views:
    3,209
    Not Me
    Jun 5, 2007
  3. Ed Cayce
    Replies:
    0
    Views:
    924
    Ed Cayce
    Aug 8, 2009
  4. Jean Rodolfo Taruhn

    Timeout using async Web Services after 5 minutes

    Jean Rodolfo Taruhn, Sep 25, 2003, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    238
    Jean Rodolfo Taruhn
    Sep 25, 2003
  5. Steven
    Replies:
    0
    Views:
    386
    Steven
    Nov 30, 2005
Loading...

Share This Page