Click here to Skip to main content
15,440,323 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am using Session on my web application.

I assign this variable on login and sets to null on logout.

I checked on master page whether session!= null
and then proceed for next pages.

But if i stop program and reopen without logout session still exist there.

Is there any way to clear session when program stops or browser get closed ?

Please guide me.

Thanks in advance
Updated 27-May-11 21:51pm

1 solution

AFAIK, you are a bit stuffed: there is no way to detect at the server that the browser is being closed. The best suggestion I can make is have a Bowser which expires when the browser closes and check that in addition to your session info. Sorry!
Share this answer
Vivek Deshmukh 28-May-11 3:42am     CRLF
Hi, Need one more suggestion from you. How can we check in our cs file that is our program is running or stopped ? If it is possible then may b it is somehow implemented .
OriginalGriff 28-May-11 4:03am    
How do you expect code to check if it is running or stopped? By definition, if the code executes, it is running, and when it doesn't execute, it can't check...
Vivek Deshmukh 31-May-11 5:48am     CRLF
As when program execution starts Application_Start, Session_start etc these methods from global.asax get called. Such like this which method is called when program execution stops? and how can i access session variable in this ? Please guide me
[no name] 28-May-11 3:52am     CRLF
Hey, voted 5++ for acuracy. can you give me any Suggestion CFileDialog tool tip crash, please see my 2 previous posts.

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