<asp:Button ID="btnRedirect" runat="server" Text="使用Redirect" OnClick="btnRedirect_Click" />
<asp:Button ID="btnTransfer" runat="server" Text="使用Transfer" OnClick="btnTransfer_Click" />
<asp:Button ID="btnExecute" runat="server" Text="使用Execute" OnClick="btnExecute_Click" />
<asp:LinkButton ID="LinkButton1" runat="server" PostBackUrl="~/Target.aspx">使用LinkButton</asp:LinkButton>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="~/Target.aspx">使用HyperLink</asp:HyperLink>
<a href="Target.aspx" target="_self">使用超级链接</a>
<input id="Button1" type="button" value="使用window.location" οnclick="window.location='Target.aspx'" />
protected void btnRedirect_Click(object sender, EventArgs e)
{
Response.Redirect("~/Target.aspx");
}
protected void btnTransfer_Click(object sender, EventArgs e)
{
Server.Transfer("~/Target.aspx");
}
protected void btnExecute_Click(object sender, EventArgs e)
{
Server.Execute("~/Target.aspx");
}