响应重定向之前asp.net延迟 [英] asp.net delay before response redirect

查看:159
本文介绍了响应重定向之前asp.net延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能由5秒延迟在一个asp.net页面的Response.Redirect?

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

像delay.response.redirect(myURL.aspx)

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

我需要的页面重定向之前运行jQuery的动画。

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.

感谢

推荐答案

如果您发布到服务器,就没有办法影响到客户端了 - 所有的服务器所能做的就是等待。而在Web服务器睡眠很不好 - 耗尽线程池,坏的性能。

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.

你应该做的是在客户端上的延迟。另外,您也可以张贴到使用AJAX该网页 - 这是一个我会preFER。投递到服务器使用AJAX,然后更改location.href之前获得响应,并等待5秒钟(在JavaScript)
你甚至可以从服务器读取新位置(从AJAX调用返回的数据)

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)

这篇关于响应重定向之前asp.net延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆