| Author: Anuraj 04 Nov 2009 | Member Level: Diamond | Rating:  Points: 2 |
You can try window.unload event. It also fire on navigating from one page to another.
Thanks Anuraj THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS. BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT. dotnetthoghts
|
| Author: Deepak Yadav 04 Nov 2009 | Member Level: Silver | Rating:  Points: 2 |
Hi, Naveen
For browser close event you may use the window.unload event, but for the user to give the facility of not giving multi login to a single user, for eg. like gmail, yahoo gives, you can create sessions for a particular user on the client side, on sign in for the first time make its value 1 and then keep it 1 until user logs out, or else clicking on logout make its value 0. Cheers coding Deepak
|
| Author: ShashiKant Gupta 04 Nov 2009 | Member Level: Gold | Rating:  Points: 2 |
when user closes his browser, it doesn't sends anything to server where you can identify it close the session so I think you are going in wrong direction.
I will suggest you another approach. create a table to maintain currently logged in users. and at user's side use timer control with update panel to update this table with user's ID and current time. this should be done each 5 or 10 mins as per requirement.
if user logs out or closes the browser window you can check it by checking the time against that user in your table, because time will stop being updated once the user logs out or closes his broser window.
hope this will help you.
|
| Author: Naveen 13 Nov 2009 | Member Level: Silver | Rating:  Points: 2 |
hi ShashiKant Gupta, Thanks for your kind reply. i understand ur idea.. but u said
"closes the browser window you can check it by checking the time against that user in your table because time will stop being updated once the user logs out or closes his broser window."
at where to write these code or which page??
Regards, Naveen.
|