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”);

}
}

Advertisement

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

  1. shantu2990 November 29, 2011 / 8:29 am

    gr8 job..the best working code i found on the internet….thankx

    • Chandra Dev November 29, 2011 / 12:48 pm

      Hi shantu,
      You are welcome. I m glad to know that my code helped you.

      Regards
      Chandradev

  2. Noor September 26, 2012 / 8:08 am

    Can you have sample sms web application using linq C# sql etc? thanks in advacne

    • Chandra Dev September 27, 2012 / 4:56 am

      Dear friend, That code is not fixed. That will depend on service provider. So what ever i will give code,that maight not be work in your project. SMS service provide will give the api code for sending sms from website.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.