, Session, ,
Session.Abandon();
Response.Redirect("Login.aspx");
, , , , , 。 , 。
http://blog.csdn.net/lhypang2006/archive/2008/03/11/2170751.aspx
Session.Abandon();
Response.Write("<script>window.location.href='Login.aspx'</script>");
, Response.Redirect Response.Write, , 。
, 。
Asp.Net HttpHandler
, IHttpHandler
public class LogoutHttpHandler : IHttpHandler
{
/// <summary>
/// IHttpHandler HttpHandler HTTP Web 。
/// </summary>
/// <param name="context">HttpContext , HTTP ( Request、Response、Session Server) 。 </param>
public void ProcessRequest (HttpContext context)
{
FormsAuthentication.SignOut();
context.Response.Redirect("Login.aspx",true);
}
web.config, <system.web></system.web> :
<httpHandlers>
<add verb="GET" path="Logout.aspx" type="LogoutHttpHandler" />
</httpHandlers>
dll, App_Code 。
ProcessRequest Session。 Response.Redirect, 。
public class LogoutHttpHandler : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
//FormsAuthentication.SignOut();//
context.Session.Abandon();
context.Response.Write("<script>window.location.href='Login.aspx'</script>");
}
}
Logout.aspx, 。
protected void Exit_Click(object sender, EventArgs e)
{
Response.Redirect("Logout.aspx");
}
:(http://www.diybl.com/course/4_webprogram/asp.net/netjs/20090412/164906.html)