Search code examples
asp.net.netasp.net-session

How to clear out session on log out


I redirect the user to the login page when user click log out however I don't think it clears any application or session because all the data persisted when the user logs back in.

Currently the login page has a login control and the code behind on the page is only wired up the login Authenticate.

Can someone direct me to a good tutorial or article about handling log in and out of ASP.NET web sites?


Solution

  • Session.Abandon()
    

    http://msdn.microsoft.com/en-us/library/ms524310.aspx

    Here is a little more detail on the HttpSessionState object:

    http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate_members.aspx