protected void logoutbtn_Click(object sender, EventArgs e) { Session["logout"] = "true"; Response.Redirect("logout.aspx"); } protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { if (Session["logout"] != null) { Session.Clear(); Response.Redirect("Login.aspx"); } } }
if (Session["logout"] != null) { if (Session["logout"] == "true") { Session.Clear(); Response.Redirect("Login.aspx"); } }
Session.Clear(); or Session.Abandon();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)