Session.Clear();
Response.Buffer = true;
Response.ExpiresAbsolute = DateTime.Now.AddDays(-1D);
Response.Expires = -1500;
Response.CacheControl = "no-cache";
//----- Second Technique : To Stop Caching of Secure Pages.
Response.Cache.SetCacheability(HttpCacheability.NoCache);
FormsAuthentication.SignOut();
if (Session["UserName"] == null)
{
Response.Redirect("login.aspx");
}       
Session.Clear();

Recommended Answers

All 3 Replies

What's the problem?

Please provide addtinional information regarding your quetsion so that we can advise...

I think the OP is just showing two ways to clear a session and cache to prevent a user hitting the back button after logging out of a site.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.