Forums
This topic is locked
forcing user logout when back button is pressed
21 May 2003 09:09:02 Touti P posted:
Once the user logs in, they are brought to different page. When they click on the browser back button to go back to the login page, how do I force them to logout? I used Session.Abandon on the login page but that didn't stop it from going to the other page when I click forward even though no password was entered. How do I avoid this?
Also, when pressing refresh, I do I get rid of the post variables to get a completely refreshed page. Thanks a bunch!
Replies
Replied 06 Aug 2007 15:14:40
06 Aug 2007 15:14:40 sourabh jain replied:
Hi,
Verify in the login page if the user is already hold an active session then redirect him/her to the default page the code for this should be like this:
protected void Page_Load(object sender, EventArgs e)
{
Response.Expires = 0;
Response.AddHeader("pragma", "no-cache"
Response.AddHeader("cache-content", "private"
Response.CacheControl = "no-cache";
if (Session["AuthenticatedUser"] != null)
{
Response.Redirect("default.aspx"
}
...
}
sourabh jain
Verify in the login page if the user is already hold an active session then redirect him/her to the default page the code for this should be like this:
protected void Page_Load(object sender, EventArgs e)
{
Response.Expires = 0;
Response.AddHeader("pragma", "no-cache"
Response.AddHeader("cache-content", "private"
Response.CacheControl = "no-cache";
if (Session["AuthenticatedUser"] != null)
{
Response.Redirect("default.aspx"
}
...
}
sourabh jain