Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the below code to log out in my project

protected void LinkButton11_Click(object sender, EventArgs e)
{
Session.Abandon();
Session.Clear();

Response.Redirect("LOGIN.aspx",true);

}

I want to prevent the user from viewing the previous page using the Back
button after logout. I want to instead show that this page has expired.
How do I do this? but I cant do it by this code...

What am I missing or doing wrong?
Posted
Updated 21-Dec-13 3:28am
v2
Comments
joginder-banger 21-Dec-13 8:54am    
sorry I can't understand what's you try??? share more information what's you want..
joginder-banger 21-Dec-13 8:55am    
which type of data you want after the session.Abandon

1 solution

Clean the cache might help.
Try this on page load -
VB
Response.Cache.SetAllowResponseInBrowserHistory(False)
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Cache.SetExpires(Now().AddSeconds(-1))
Response.Cache.SetNoStore()
Response.AddHeader("Pragma", "no-cache")
Response.Write("" & DateTime.Now.ToLongTimeString())
 
Share this answer
 
Comments
[no name] 21-Dec-13 10:43am    
when I used above code I got errors like

Error 1 The name 'False' does not exist in the current context
Error 2 The name 'Now' does not exist in the current context
Abhinav S 21-Dec-13 11:54am    
Use false not False.
[no name] 21-Dec-13 23:58pm    
But still I have the same problem...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900