I’m trying to implement Redirect After Post for the first time in ASP.NET. Assuming my business objects may take several seconds to a minute to complete, in what order, and what syntax do I use?
For example:
-
User POST’s
-
Server issues Server.Transfer or Response.Redirect
- Server does something that takes a minute or two Thread.Sleep
What is the best way to handle this type of situation?
In this case, it is probably best to just stick with
Response.Redirect()so that the user’s client is issued a redirect, rather thanServer.Transfer()which performs a purely server-side redirect to a different context.Regarding the process which requires the user to wait, you may want to use some sort of asynchronous implementation where the time-consuming operation is placed in a background thread; meanwhile the user, instead of waiting on a blank loading screen, is given
Response.Redirect()to a “Processing” page that polls the server for completion of the current operation and updates the user. For added polish, consider implementing something like Facebook’s image uploader which overlays a progress bar in the corner of the screen while the user continues normal use of the website.