473,406 Members | 2,894 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

logout at window close event

hi....
Currently i am working in a project where i have to maintain the time in between the user logged in. but i got a problem when the user close the application through browser window's close event.
I am working in ASP.Net with C#
Feb 22 '08 #1
5 1955
Shashi Sadasivan
1,435 Expert 1GB
One solution would be that whenever a page is requested, it update the time of last activity. If the page is requested and the time of last activity of that user exceeds the defined time interval then you may log the user out or take appropriate actions.

If you want to handle window closing ,i dont think even a javascript might help with that. I dont have experience with javascript, but only that could detect if the window is closed and send an appropriate response to the server, however if the window is closed, that javascript will seize to complete.
Feb 22 '08 #2
One solution would be that whenever a page is requested, it update the time of last activity. If the page is requested and the time of last activity of that user exceeds the defined time interval then you may log the user out or take appropriate actions.

If you want to handle window closing ,i dont think even a javascript might help with that. I dont have experience with javascript, but only that could detect if the window is closed and send an appropriate response to the server, however if the window is closed, that javascript will seize to complete.
I want to handle the close event how they performed doesnt matter. bt i have to maintain the logout time that is what time user spends by online to the site. i dont understand when to fire the code.
Please give me some suggestion that how can i perform that.

Thanks
Feb 22 '08 #3
Plater
7,872 Expert 4TB
You could, for all your pages, have a javascript that fires on interval (once every 10-30secs?) that acts as a "heart beat", which can be used to tell if the user has left your pages or not.
Feb 22 '08 #4
You could, for all your pages, have a javascript that fires on interval (once every 10-30secs?) that acts as a "heart beat", which can be used to tell if the user has left your pages or not.
hello platter

Do u want to tell that i call a javascript which runs after every 20-30 second.
Bt if a user close browser in between this then how can i handle the logout event.
Can u provide me a little bit of code that how can i do that?
Feb 25 '08 #5
Plater
7,872 Expert 4TB
Well if you're getting that "heartbeat" from the user, you know they are still on the page. If they log out or close the browser window, you won't be getting that heartbeat and can tell that they are not there anymore.
It's not a simple thing to implement, but what you request is not a normal behavior of web applications and some work will have to be put forth to achieve this.
Feb 25 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Tom Szabo | last post by:
Is there an event when that triggers when the window is closing.... I am talking about when the user clicks on the cross on the right top corner of the window!!!
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
2
by: Mark | last post by:
The session_end event in the global.asax doesn't seem to fire very often. Is there a reliable way to capture when a user (a specific session_id) closes their browser window aside from forcing them...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
6
by: somaskarthic | last post by:
Hi This is somas here. I asked query about detecting the browser close event using javascript. I want to detect the event only when the X button in the top right corner is clicked and not else...
5
by: jimmy | last post by:
Hi all, I want to capture the event when the browser's close button is clicked in an html page. I tried using the event.ClientX and event.ClientY property in the body unload event, and this...
5
by: Nithu25 | last post by:
Hi All, I have a parent window where i have three links. On clicking those links, new window will be opened as a pop up. When i logout from the parent window, the child windows should be closed....
6
by: Thiago Macedo | last post by:
I could not find on the web a complete solution for this task. This is not the perfect solution, because it's doesn't have the ability to log the logout if browser crash or user leave it open while...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.