Sunday, September 18, 2011

Disable browser back button

Add the following code to the Page_Load event of ASP.NET web page

// Disable the Cache

Response.Buffer= true;
Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
Response.Expires =-1500;
Response.CacheControl = "no-cache";
// Check for your SessionID
if(Session["SessionId"] == null)
{
   Response.Redirect ("Home.aspx");
}

No comments:

Post a Comment