I am developing a web page. My problem is when users click on log out button, they are diverted to the log in screen. But if they click back on the login screen then it allows them to go straight back to the last screen. I would like to prevent this from happening as they should not be allowed to do this.
Here is my code for the logout page.
public partial class Logout : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Session.Clear();
Session.Abandon();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetNoStore();
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);
}
Response.Redirect("~/Login.aspx");
}
}
}