How to disable backward functionality on logout button click in asp.net?


Hi
We can disable the backward functionality on logout click in asp.net by clearing the cache memory of that page. We can write the code for clear the cache memory on master page or secure private page like this

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SiteMaster : System.Web.UI.MasterPage
{
protected void Page_Load(object sender, EventArgs e)
{

Response.Buffer = true;
Response.CacheControl = “no-cache”;
if (Session[“Name”] == null)
{
Response.Redirect(“Login.aspx”);
}
Label1.Text = Session[“Name”].ToString();

}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Session[“Name”] = null;
Response.Redirect(“Login.aspx”);

}
}

Advertisements