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

sql - VB.NET Operand type clash: date is incompatible with int error -

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

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -