2012年3月26日月曜日

Response.Redirect inside a Thread

I have the following problem. I have to execute a async procedure in a thread. The Problem is that when the thread is completed I need to show the results in a new form. The moment i execute the Response.Redirect the following error is thrown. : Response is not available in this context.

I have also tried server.Transfer but with no luck

hello.

have you thought about using async pages?


What do you meen with Async Pages ? I am relatively new to the whole asp.net thing.

hello again.

take a look here:

http://msdn.microsoft.com/msdnmag/issues/05/10/WickedCode/Default.aspx


You canuse an iframe to execute remote code pretty easily, as well.


Maybe I can explain a bit what I am trying to do. I have a form that needs to check when a MSMQ message comes in to forward onto anothter page. The Problem is that if I have a Timer everything works but the timer cause a lot of traffic. So I moved fun getMessage function into a thread and all is well untill I want to show a new form then I get the error.


If you can check that message queue in a static method (should be able to), this might be exactly what you need:http://encosia.com/2007/07/25/display-data-updates-in-real-time-with-ajax/

Just do a "document.href = RedirectPage.aspx;" instead of the call to __doPostBack(), when the page method detects that the message has arrived.

0 件のコメント:

コメントを投稿