asp.netresponse.redirect

asp.net delay before response redirect


Is it possible to delay the response.redirect in an asp.net page by 5 seconds?

something like delay.response.redirect("myURL.aspx")

I need to run a jquery animation before the page redirects.

I don't want to use meta refresh if I can help it but if that's the only way or the best way then please let me know.

thanks


Solution

  • if you posted to the server, there's no way to affect client anymore - all server can do is wait. And sleeping in web server is very bad - exhausts thread pool, bad for performance.

    What you should do is delay on the client. Alternatively, you can post to that page using AJAX - that's the one I would prefer. Post to server using ajax, then get the response and wait 5 seconds (in javascript) before changing location.href You can even read the new location from the server (from the data returned by ajax call)