Click here to Skip to main content
15,886,678 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I have maintained session in my web application. but after sign out whenever i press back button in browser it shows the page with log in.


What should i do to make page expired at client side??
Posted

Have you tried these?
MIDL
Session.Abandon();
Session.RemoveAll();
Session.Clear();

or
MIDL
Response.Buffer = false;
Response.Expires = 0;
Response.Cache.SetNoStore();
Response.AppendHeader("Pragma", "no-cache");
 
Share this answer
 
Other ways to Clear Browser History

You can clear browser history through JavaScript....

JavaScript
//clears browser history and redirects url
<SCRIPT LANGUAGE=javascript> {  var Backlen=history.length;   history.go(-Backlen);   window.location.href=page url }</SCRIPT>


OR
C#
Page.ClientScript.RegisterStartupScript(this.GetType(),"cle","windows.history.clear",true);


OR as you say in you logout event:
C#
protected void LogOut()  
{      
     Session.Abandon();      
     string nextpage = "Logoutt.aspx";      
     Response.Write("<script language=javascript>");            
     Response.Write("{");      
     Response.Write(" var Backlen=history.length;");      
     Response.Write(" history.go(-Backlen);");      
     Response.Write(" window.location.href='" + nextpage + "'; ");
     Response.Write("}");      
     Response.Write("</script>");  
}
 
Share this answer
 

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