16 March 2009
20:49:01
sergey
Posts: 0
|
ASP Net - ASP.NET - Logout from code
Page_Load
Response.Expires = 60
Response.Expiresabsolute = Now() - 1
Response.AddHeader("pragma","no-cache")
Response.AddHeader("cache-control","private")
Response.CacheControl = "no-cache"
or:
FormsAuthentication.SignOut
http://msdn2.microsoft.com/en-us/lib...signout.as px
|
16 March 2009
20:54:19
sergey
Posts: 0
|
Re: ASP Net - ASP.NET - Logout from code
protected void LoginStatus1_LoggedOut(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Roles.DeleteCookie();
Session.Clear();
FormsAuthentication.RedirectToLoginPage();
}
|
16 March 2009
20:59:07
sergey
Posts: 0
|
Re: ASP Net - ASP.NET - Logout from code
protected void lnkbtnLogout_Click(object sender, EventArgs e)
{
try
{
FormsAuthentication.SignOut();
Session.Abandon();
Response.Cache.SetCacheability(HttpCacheability.Private);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Redirect("~/Login.aspx");
}
catch (Exception ex)
{
throw ex;
}
}
|
16 March 2009
21:00:24
sergey
Posts: 0
|
Re: ASP Net - ASP.NET - Logout from code
protected void logout()
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Session.Clear();
FormsAuthentication.SignOut();
DisableBufferingOnPage()
}
protected void DisableBufferingOnPage()
{
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); // set expiry date in the
past
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();
Response.AppendHeader("Pragma", "no-cache");
}
|