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

I have query that is:

I logged into the application with username and password and by mistaken i have closed the application instead of doing logging out.
when i again logging in it showing that

"User currently logged in".

how can i make the users logged out when they close the application.

This is in windows application.

Please help me,

Regards,
Nagaraju.N
Posted
Updated 14-Dec-10 22:04pm
v3
Comments
Arindam Tewary 15-Dec-10 3:32am    
what type of application you have been referring to? Is that web or windows ?
Abdul Quader Mamun 15-Dec-10 3:40am    
Is this windows application?

Handle the main form FormClosing event[^] and auto log out there.

It may be worth your putting a timeout on logins, so they are only valid for a finite period, or issuing them with a session ID so that you can tell when a session reached an abnormal termination and the login shoudl have been invalidated.
 
Share this answer
 
If web application
Use sessions. Set it to null on Global file [Application_End]. Make sure that they are redirected to loggin page if session is null.
 
Share this answer
 
Comments
senguptaamlan 15-Dec-10 4:38am    
Application_End don't file when a user closes browser.
This would have happened when you had used tabbed-browser. In tabbed browser, but default the session is shared across and closing one tab does not clear the session. It is more of the browser setting related than application setting.
 
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