Question

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.

Was it helpful?

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

OTHER TIPS

These things should be implemented when logging out-

FormsAuthentication.SignOut(); //Removes the forms-authentication ticket from the browser.
Session.Clear();               //clear all session values
Session.Abandon();             //Remove session objects

FormsAuthentication.RedirectToLoginPage(); //redirect the user back to the login page
//OR
Response.Redirect("/Default.aspx"); //whichever page you need.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top