asynchronous

  • Thread starter Thread starter TS
  • Start date Start date
T

TS

when calling
BeginInvoke

on a delegate, this performs an asyn call. In the method that the delegate
raises, why don't i have access to httpcontext.current?

how can i save something to state in this method?

thanks
 
TS said:
when calling
BeginInvoke

on a delegate, this performs an asyn call. In the method that the delegate
raises, why don't i have access to httpcontext.current?

how can i save something to state in this method?

Because that HTTPContext is belongs to the thread which called BeginInvoke.

You can't access it from another thread, and shouldn't try.

From your original thread you can call EndInvoke to wait for the delegate
method to complete and access the HTTPContext from there.

David
 
it seems the only way i can save state in this other thread is by saving to
database or to external file source. Are there any other ways available?

thanks
 
Hi TS,

Another engineer has replied on another thread you have posted. You can try
to do the following:

1. make a central async processing httphandler which do the time consuming
task. And we call this handler in the clientside page through clientside
script (using MSXML.XMLHTTP component) and pull data from serverside so as
to refresh our page.

2. consider adjusting our page's design and using the asp.net's buildin
page/handler level async processing model. The following msdn article(as
also mentioend by Brock ) has demonstarte this mode:

http://msdn.microsoft.com/msdnmag/issues/03/06/Threading/default.aspx

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top