11 February 2014

Avoid back button after logout in asp.net application

protected void LinkLogout_Click(object sender, EventArgs e)
 {
     try
         {
                Session.Abandon();
                FormsAuthentication.SignOut();
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.Buffer = true;
                Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
                Response.Expires = -1000;
                Response.CacheControl = "no-cache";
                Response.Redirect("login.aspx", true);
          }
        catch (Exception ex)
         {
            Response.Write(ex.Message);
          }
}

No comments:

Post a Comment