Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
Hi friends,

I am using Visual Web Developer 2008 Express. I want to know how to clear history of my project after I logout from it. My forms with contents are displaying in IE->view->explorer->history.
I want to clear my project pages in that history.
Posted
Updated 19-May-10 0:10am
v2

1 solution

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>");   
}


Just Google it if you face issues!
 
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