How to make a functioning logout page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shantanuad
    New Member
    • Jun 2010
    • 1

    #1

    How to make a functioning logout page

    i have a logout link on my page
    Code:
     protected void LinkButton1_Click(object sender, EventArgs e)
        {
           
            Session.Abandon();
            Response.Clear();
    
    
            FormsAuthentication.SignOut();
             Session.RemoveAll();   
             
            
            Response.Redirect("~/Logout.aspx");
        }
    i put everything which i can but problem is, when i go back after pressing logout link, i got the previous page.

    i can put the code like

    Code:
    <Script>
    window.history.forward(1);
    </Script>
    but it will just restrict me to go back.
    not really logout. how i get sure that i am succefully logout in this restriction

    help me
    Last edited by Niheel; Jun 18 '10, 04:03 PM. Reason: please use code tags
  • ThatThatGuy
    Recognized Expert Contributor
    • Jul 2009
    • 453

    #2
    Originally posted by shantanuad
    i have a logout link on my page
    protected void LinkButton1_Cli ck(object sender, EventArgs e)
    {

    Session.Abandon ();
    Response.Clear( );


    FormsAuthentica tion.SignOut();
    Session.RemoveA ll();


    Response.Redire ct("~/Logout.aspx");
    }

    i put everything which i can but problem is, when i go back after pressing logout link, i got the previous page.

    i can put the code like

    <Script>
    window.history. forward(1);
    </Script>

    but it will just restrict me to go back.
    not really logout. how i get sure that i am succefully logout in this restriction

    help me
    You can delete all that code you wrote..
    on logout click ... clear the required session variables and cookies...
    And simple do Response.Redire ct() to the Home page or whatever page you like..

    As simple as that...

    Comment

    Working...