I have 3 active Sessions in my website Session[“name”], Session[“lastname”] and Session[“username”], does Session.Abandon() will abandon all of them?
I have 3 active Sessions in my website Session[name], Session[lastname] and Session[username], does Session.Abandon()
Share
Actually, you have one active session (not three). That session has those three key/value pairs associated with it.
Yes, Session.Abandon() will remove all of those variables in the process of abandoning the session, as soon as processing of the current page has finished.
http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.abandon.aspx
http://msdn.microsoft.com/en-us/library/ms524310(v=vs.90).aspx
UPDATE
If you want to “get rid of” the key/value pairs before the page finishes executing, you can clear them like this:
http://msdn.microsoft.com/en-us/library/ms524866(v=vs.90)