Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP.NET 2.0 Async Webservice Calls?

Status
Not open for further replies.

beefeater267

Programmer
Apr 6, 2005
79
Hi,

I have a VS.NET 2003 project that I am converting to .NET 2.0 / VS.NET 2005. So, basically I have a web service and a web app that consumes the service. So, from VS.NET 2003, I could make calls like:

webService.BeginFoo and webService.EndFoo

But, when I began porting over my code, I noticed that things have changed and that there is no longer Begin.. and End... functions, but rather FooAsync and event handlers.

So, I modified my code to call the FooAsync and wired up a ...Completed event handler to the web service object. However, now I am getting runtime errors like:

Async call is not valid in this context...... add AddOnPreRenderCompleteAsync, etc.... something like that.... So, I tried to add the call such as:

AddOnPreRenderCompleteAsync(new BeginEventHandler(...), new EndEventHandler(...))

But, i don't exactly know what to put in the (...) places. It looks for a function like IAsyncResult = .......

It doesn't make sense why i would have to do this..... i thought by adding event handling for async calls, Begin.... / End.... is obsolete

Can anyone provide an example / explanation?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top