Hi TS,
AS for async processing in ASP.NET web application, direclty use the .net
delegation's Beginxxx call won't work quite work since when the underlying
working thread complete executing, the original httpRequest(in fact the
whole Httpcontext) may already been disposed. So currently two possible
async means we can choose are:
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
Hope helps. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure!
www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| From: "TS" <
[email protected]>
| References: <OF#
[email protected]>
<
[email protected]> <op.sujfpza5f3yrl7@asbel>
| Subject: Re: Async method raised in web page doesn't refresh page
| Date: Tue, 26 Jul 2005 16:37:39 -0500
| Lines: 32
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <
[email protected]>
| Newsgroups:
microsoft.public.dotnet.framework.aspnet,microsoft.public.dotnet.languages.c
sharp
| NNTP-Posting-Host: 103nat100.tea.state.tx.us 198.214.103.100
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.languages.csharp:112406
microsoft.public.dotnet.framework.aspnet:114592
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I don't see how you can use the session in the async method, because that
| method is the start of the new thread that doesn't has access to
HTTPContext
| object. Are you saying that you are passing the session object to the
async
| method and NOT that you are using the session object in async method and
set
| its return value to the session object?
|
| thanks for your posts.
|
| | > > Then, on the client side, you will have to poll some page over and
| > > over
| > > again until the operation completes. When it does, you can get the
| > > results
| > > and post them on the page accordingly.
| > >
| > The server side code can ask the client to refresh like this:
| >
| > // Ask client to refresh every 3 seconds
| > Response.AppendHeader("Refresh", "3");
| >
| > Next, you have to find a way to pass the results from the asynchronous
| > callback to the web page. I did this by passing the Session object in
the
| > IAsyncResult.AsyncState field. The Session object can then be accessed
| > from both the web page and the asynchronous callback function.
| >
| > Works nicely, but watch out for concurrency issues...
| >
| > Greetings,
| > Wessel
|
|
|