Click here to Skip to main content
15,915,682 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
hi

i am facing a problem with the active user and inactive user, in my web application that when user login i am changing the status as 1 in database,and when user logout, then iam changing the status as 0 in database
upto now every thing is fine ,

when the user exits the browsers without loging out, then how can i find this type of user to chage the status as 0 in database


is there any idea to change the status in the database , generally in this type of situations what the programers should do

so please give me an idea.

thanks in advance
Posted
Comments
BobJanova 19-Jan-12 12:02pm    
Short answer: don't do this, it's almost always bad design.
[no name] 24-Jan-12 5:14am    
Mr.BobJanova nice replay,................

thankq for your replay

You can update database on pageunload event,

and you can also use trigger to update the database after specific interval of time (for eg 1 hour,1 day etc) on the base of session
 
Share this answer
 
Comments
RDBurmon 19-Jan-12 6:39am    
My +5
manognya kota 19-Jan-12 8:43am    
Good answer +5
hello,


you can get the session_end() event in global.asax.
on that event you can write code to set zero in database.
 
Share this answer
 
Comments
bbirajdar 24-Jan-12 5:42am    
Closing the browser window, or browsing to another site will NOT cause Session_End to fire, at least, not straightaway - the server has absolutely no way of knowing what happens on the client machine until it gets another HttpRequest from it. In this instance, Session_End will fire when the session times out naturally.
amolpatil2243 24-Jan-12 6:19am    
thanks for update

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