Server.Execute("register.aspx");
Response.Redirect("register.aspx");
Server.Transfer("register.aspx");
HyperLink1.NavigateUrl = "register.aspx";//HyperLink是控件
也可以加上Request.ApplicationPath
如:
Server.Transfer(Request.ApplicationPath+ "/register.aspx");
HyperLink1.NavigateUrl = Request.ApplicationPath+ "/register.aspx";
假设:
跳转前地址是http://localhost/LoginApplication/WebForm1.aspx
执行Response.Redirect("register.aspx");后
结果跳转到的页面是http://localhost/LoginApplication/register.aspx
但是执行Server.Transfer("register.aspx");后
跳转以后页面仍然是跳转前页面的地址:
http://localhost/LoginApplication/WebForm1.aspx
本文介绍了四种常用的网页跳转方法,包括Server.Execute、Response.Redirect、Server.Transfer及HyperLink控件的使用方式,并详细对比了Response.Redirect与Server.Transfer的区别。通过实际案例展示了不同跳转方法在URL变化上的具体表现。
1万+

被折叠的 条评论
为什么被折叠?



