页面代码:
<asp:LinkButton ID="btnQuit" runat="server" OnClick="btnQuit_Click" Text="退出" ></asp:LinkButton>
后台代码
using System.Web.Security;
using System.Security.Cryptography;
protected void btnQuit_Click(object sender, EventArgs e)
{
//FormsAuthentication.SignOut();
//Request.Cookies.Clear();
//Session.Clear();
//Response.Write("<script>alert('退出成功!');top.window.location.href='要去的页面地址'</script>");
FormsAuthentication.SignOut();
System.Web.HttpContext.Current.Request.Cookies.Clear();
System.Web.HttpContext.Current.Session.Clear();
System.Web.HttpContext.Current.Response.Write("<script>alert('退出成功!');top.window.location.href='login.aspx'");
}