I have this link to Logout. How can I logout clearing my session The current session needs to be cleared/abandoned when user clicks sign out. Then direct user to the log in page(a URL is given ex., login.com)
<a href="#">Sign Out</a>
Never worked on session. How can I proceed further?
CodePudding user response:
You can try implementing Session.Abandon() Method.
Session.Abandon();
public ActionResult LogOut()
{
FormsAuthentication.SignOut();
Session.Abandon();
return RedirectToAction("index", "login");
}
For Session Timeout, check this - https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525473(v=vs.90)
For Session Abanden Method, check this - https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524310(v=vs.90)
For HttpSessionState Method, check this - http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate_members.aspx