PC Review


Reply
Thread Tools Rate Thread

(Ajax) Loading a web service after async postback

 
 
elado7@gmail.com
Guest
Posts: n/a
 
      15th Oct 2007
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LoadPageStateFromPersistenceMedium not loading when ajax postback Eric Microsoft ASP .NET 0 24th Jan 2010 01:59 AM
Any way to convert an async postback to a full postback incode-behind? Ed Cayce Microsoft ASP .NET 0 8th Aug 2009 12:23 AM
Async Pages & Ajax progress bar? =?Utf-8?B?RGF2ZQ==?= Microsoft ASP .NET 2 11th Dec 2007 02:09 PM
the j in ajax: run javascript method on async postack =?Utf-8?B?cm9kY2hhcg==?= Microsoft ASP .NET 4 24th Oct 2007 12:06 AM
Async web services / asp.net 2.0 web parts / Ajax tg Microsoft ASP .NET 0 14th Nov 2006 08:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:01 AM.