Page_Load中的Response.Redirect [英] Response.Redirect in Page_Load
问题描述
我的 Page_Load
中有一个 Response.Redirect
:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
...Code
Response.Redirect("http://www.mysite.com")
End Sub
在添加Response.Redirect之前,我还有其他具有正常工作代码的子例程
I have other Subroutines with working code before adding the Response.Redirect
添加 Response.Redirect
后,他们都不会处理其代码,而是自动执行 Response.Redirect
网站.
When the Response.Redirect
is added they all do not process their code and automatically execute the Response.Redirect
website.
我的代码在没有 Response.Redirect
时有效.
My code works when there is no Response.Redirect
.
推荐答案
使用
Response.Redirect("http://www.mysite.com", false)
第二个参数指示当前页面的执行是否应该终止.
second parameter Indicates whether execution of the current page should terminate or not.
如果您使用 Response.Redirect("http://www.mysite.com")
,则当前页面执行将终止
if you use Response.Redirect("http://www.mysite.com")
, current page execution will terminate
这篇关于Page_Load中的Response.Redirect的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!