简体   繁体   中英

back button of browser issue in asp.net logout

when i click on logout button, everything will be fine after that click on back button of browser user does not enter or login ..thats also good.(but, no event click on master pages; working is good )

and, any event is clicked like search items (i mean using select query or fetch data through button click)

logout button working not good ...its work like normal page ;ie when i click on logout ...redirect to home page using Session.clear(); & Redirect.Response("page.aspx")

Use this code,behind master page page_load:

if (!IsPostBack)
        {

            if (Session["name"] == null)
            {

                Response.Redirect("Default.aspx");
            }

            else
            {

                Response.ClearHeaders();

                Response.AddHeader("Cache-Control", "no-cache, no-store, max-age=0, must-revalidate");

                Response.AddHeader("Pragma", "no-cache");

                Label1.Text = "WELCOME" + " " + Session["name"];


            }

now i want to disabling back button without using of javascript, because reason is when someone stop the javascript of browser ....same issues occurs..

private void Page_Load(object sender, EventArgs e)
    {
        // Put user code to initialize the page here
        if (Session["SessionId"] == null)
        {
            Response.Redirect("Login.aspx"); 
        }


        Response.Buffer=true;
        Response.ExpiresAbsolute=DateTime.Now.AddDays(-1d);
        Response.Expires = -1500;
        Response.CacheControl ="no-cache";

    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM