Click here to Skip to main content
15,922,407 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more: (untagged)
hi
im doing an asp.net website with a login system for its users. i used a table in sql to maintain a record of user details.when a user logs in , i set a flag to 1 and when they click the logout button , the flag is set back to 0. my problem is if the user closes the browser window or for some reason the system crashes , that user still remains logged in. i have 2 go to the database and set the flag. please suggest some way to solve my prob. thanx
Posted

1 solution

There are many ways to do this.

1 - Handle the session_end event and reset the DB flag there. This event gets fired when session timed out and will happen even user closes browser (not immediately). Works only on InProc session mode.
2 - Create a new column in table which has the user's last request time. Write a SQL job which runs frequently, checks the last request time and update the flag if necessary.

:)

 
Share this answer
 


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