开发者

Reload or redirect from within thread

In my ASP.NET page I have a thread that runs for a while (sometimes up开发者_高级运维 to 2 mins). How could I reload/ redirect the page after the thread is done? I know I can't use Response.Redirect() because the page is already done loading.


You might consider an AJAX webservice and a periodic polling by the client. On the server side, in addition to the webservice, you'd need a way to uniquely identify these tasks that run in the separate thread, and a way to store or know when the thread has finished, so that the webservice may look that up.

Once the client receives an AJAX response indicating that the task is done, you then trigger the redirect via JavaScript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜