c# - ASP.NET: How to end session when the user clicks log-out? -


i ask on how end session in asp.net when user clicks log-out because 1 of professors found out when clicks log-out , click button on browser, session still active , wants specific session ended, , happen when click log-out.

thank you.

the abandon method should work (msdn):

session.abandon(); 

if want remove specific item session use (msdn):

session.remove("youritem"); 

edit: if want clear value can do:

 session["youritem"] = null; 

if want clear keys do:

 session.clear(); 

if none of these working fishy going on. check see assigning value , verify not getting reassigned after clear value.

simple check do:

 session["yourkey"] = "test";  // creates key session.remove("yourkey");    // removes key bool gone = (session["yourkey"] == null);   // tests remove worked 

this kelsey's answerclick here


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -