views:

333

answers:

6

Javascript?

Metatag refresh?

Response.Redirect (to self)

Server.Transfer (to self)

Ajax update panel?

+2  A: 

Check out this article on Asynchronous Pages. Here's also an example from CodeProject that includes Asynchronous pages and META-REFRESH.

Jose Basilio
Asynch pages in ASP.Net will execute on another thread, but will not be any better on time-out issues (load balance time-out ASP.Net script timeouts)
Kb
+3  A: 

Let's look at the options:

Javascript?

That works fine, as long as the user haven't disabled it.

Metatag refresh?

A deprecated method in favour of the Javascript method. However, you could use it as a backup if the user has disabled Javascript.

Response.Redirect (to self)

That doesn't work, as the browser would not show anyhing useful for the user while redirecting. Also, the browser will stop requesting after a certain number of redirects to protect the user from infinite redirects.

Server.Transfer (to self)

Doesn't work either, as the code on the server would just loop without sending anything to the browser. The effect is the same as just having a loop in your code.

Ajax update panel?

Works fine, as long as the user haven't disabled Javascript. It's basically the same as the first option, only the Javascript does the request itself instead of letting the browser do the request.

Guffa
A: 

I'd recommend using Ajax and displaying an UpdateProgress so the user knows it's still churning away.

DOK
+1  A: 

You can find a sample implementation of this kind of functionality in the Beer House Starter Kit- http://www.asp.net/Downloads/starter-kits/the-beer-house/.

The pages SendingNewsLetter.aspx and SendNewsLetter.aspx will be useful to you. This might be overkill for your need though- it even shows progress of the long running operation.

RichardOD
+1  A: 

Hi,

What about using the AJAX WebModalAnchor to pop up a window with a cancel button?

Hope this helps,

Bill

Bill Mueller
+3  A: 

If you can report any kind of progress to the user, I tend to run with an asxh and a variation of a forever frame. Add a bit of jQuery UI Dialog and jQuery UI Progress Bar and you've got a shiny way of holding the users attention while you do the heavy lifting on the server.

I gave some example code at 874204 that demonstrates the technique.

If you can't give progress to the user, I tend to still use UI dialog and pop a "please wait, processing..." message with a web two dot oh compliant spinny gif.

Dan F
Read your answer - it's good stuff. I'm eager to try it out.
David Robbins