Click here to Skip to main content
15,881,812 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am a beginner and I am doing a project on shopping site. My logout code works on Firefox and Chrome but it does not really work on IE. Please help me solve this..

Here is my code..

C#
protected void Page_Load(object sender, EventArgs e)
   {
       if (!Page.IsPostBack)
       {
           if (Session["admin_un"] != null)
           {
           }
           else if (Session["admin_un"] == null)
           {
               Response.Redirect("../Admin/AdminLogin.aspx");
           }
       }
   }

    public void sessionclear()
    {
        Session.Clear();
        FormsAuthentication.SignOut();
        string nextpage = "../Admin/AdminLogin.aspx";
        Response.Write("<script language=javascript>");
        Response.Write("{");
        Response.Write("var backlen=history.length;");
        Response.Write("history.go(-backlen);");
        Response.Write("window.location.href=" + nextpage + ";");
        Response.Write("}");
        Response.Write("</script>");
        Session["admin_un"] = null;
        Session.Abandon();
    }

    protected void lbtn_logout_Click1(object sender, EventArgs e)
    {
        sessionclear();
        Response.Redirect("../Admin/AdminLogin.aspx");
    }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900