Hi,
The problem with ASP.NET is when a "In Progress page" is displayed, the
HttpContext already end response, i.e., all information are sent to the
client. So when a callback returns, nothing more can be written to the
client's browser. And if I do a redirect, it result an error because
the code behind class doesn't know which browser it should communicate
to (because it ended response to the browser thus the client browser is
in a "disconnected" state).
I can think of two ways to do this.
1. Use JavaScript.
Have a timed redirect script inject to the "In Progress page." When
times up, the page redirects to the result page and if the result is
not ready, it goes back to the "In progress page" and wait again until
the result is ready (or timeout). The problem of this is the timed
parameter is fixed because you don't know in real time how long will
the web service take to return your call. So in the worst case it takes
twice as long to get the result (of course, this can be reduced but
it's kind of like a passive fix to the problem).
2. Tell the "In progress page" to send part of the page to the client
browser while waiting for the result. This would be ideal but I don't
know how to do it.
I don't have much problem dealing with async call directly, but how the
Page and the Client browser interact to get the solution works.
The solution I want is like the bank websites that after you login, it
display a page saying "We are gathering your information..." and then
direct you to summary page of your bank account.
Thanks,
Homa Wong
> Hi,
>
[quoted text clipped - 13 lines]
> > Thanks,
> > Homa Wong
Trevor Pinkney - 23 Feb 2005 19:23 GMT
I've never done this before but I imagine you need Response.Flush... something
like this.
private void Page_Load(object sender, System.EventArgs e)
{
Response.Write("Wait 4 Seconds...<BR><BR>");
Response.Flush();
System.Threading.Thread.SpinWait(99999999);
Response.Write("4 seconds is up. Redirecting in 4 seconds to google.com");
Response.Flush();
System.Threading.Thread.SpinWait(99999999);
Response.Write("<script>window.location='http://www.google.com';</script>");
Response.End();
}
For some reason this code I have posted doesn't totally work cause sometimes
the 'wait 4 seconds' message doesn't show up. Its just to give you an idea
and you can play around with it.
http://blogs.msdn.com/nunos/archive/2004/03/12/88489.aspx#FeedBack might
help you.
-Trevor
> Hi,
>
[quoted text clipped - 60 lines]
>>> Thanks,
>>> Homa Wong
Homa - 23 Feb 2005 19:50 GMT
Hi,
I actually found the solution. Here is the link.
http://msdn.microsoft.com/msdnmag/issues/03/12/designpatterns/default.aspx
Cheers,
Homa Wong
> I've never done this before but I imagine you need Response.Flush... something
> like this.
[quoted text clipped - 10 lines]
>
> System.Threading.Thread.SpinWait(99999999);
Response.Write("<script>window.location='http://www.google.com';</script>");
> Response.End();
> }
[quoted text clipped - 72 lines]
> >>> Thanks,
> >>> Homa Wong