Click here to Skip to main content
16,004,969 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my project I have used session and when I logout i have written session.abandone().
is it good or I should null all my session variable.

please help me.

Thanks.
Posted

Itz good approach. Because session does not end when a user closes his browser. There is no communication with the server when a browser is closed so there is no way the server can know to end the session.
 
Share this answer
 
I think you used the best method. instead of that you can use
VB
Session.Clear()
Session.RemoveAll()

those are clear the session but keep session in memory in live.

if you are using inproc mode to store the session (not the sql server or state server ) globle.asax file session_end() event will fire when ever called
session.abandone().
or time out of the session . if you want to expire session automatically after some time you can use
<system.web><sessionState mode="InProc" timeout="20"></sessionState>
 </system.web>


where time out in mints.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900