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