Search code examples
asp.netlogoutlinkbutton

how to redirect page on default page using FormsAuthentication?


I am using a small application in VS2005. I created a login panel with using login control provided by visual studio.

I used form authentication for this. Its working fine. Now I want to create logout functionality on a linkbutton using form authentication.

How I can implement this functionality? Please provide valuable response.


Solution

  • your Log-out link button code should be:

    //sign out from form authentication
    
    FormsAuthentication.SignOut();
    
    //abandon session
    
    Session.Abandon();
    
    Response.Redirect("logon.aspx"); 
    

    you can find more detail at below link . Log-Out using form Authentication