Results 1 to 5 of 5
- 04-20-2012, 12:24 PM #1
Member
- Join Date
- Mar 2012
- Posts
- 16
- Rep Power
- 0
Logging out a user when browser is closed
I have a java servlet which is connected to a database X. X has 4 fields in it
1.User name
2.logged in time
3.logged out time
4.Is logged in.
Whenever a user logsout from the application, those 4 fields get updated. I have used cookies to store username in log in servlet and called it in logout servlet.
Now, if the user does not logout but just closes his browser, he must be anyways logged out, and those 4 fields must get updated ..which am not able to do.
Any help is appreciated. Thank you.
- 04-20-2012, 01:24 PM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Logging out a user when browser is closed
That's not generally the best way of determining the state of someone's login in a webapp.
Normally you'd simply rely on the Session.
You have no idea when the browser is shut down.
Without some form of monitoring of last access or somesuch this isn't generally doable.Please do not ask for code as refusal often offends.
- 04-23-2012, 07:25 AM #3
Member
- Join Date
- Mar 2012
- Posts
- 16
- Rep Power
- 0
Re: Logging out a user when browser is closed
Actually whenever a user closes his browser and opens it again, he is prompted to login..So i say virtually he is logged out.. but those fields in the database are not updated. SO log out is not complete in real sense. So u say this is not doable???
- 04-23-2012, 09:01 AM #4
- 04-23-2012, 11:00 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,438
- Rep Power
- 16
Re: Logging out a user when browser is closed
They're not "virtually logged out".
I suspect it simply clears the cookies or something, which is entirely browser side.
This is doable, but you need more data in the database and a separate process that logs out users that have no active session id (using something like a session monitor).
It won't be instant, it will take however long the session timeout is plus the monitoring period.Please do not ask for code as refusal often offends.
Similar Threads
-
Could not access the URL through the external browser. Check the browser configuratio
By volkvanmyn25 in forum New To JavaReplies: 0Last Post: 11-17-2011, 04:52 AM -
Safari browser not logging off
By satyan in forum Java AppletsReplies: 1Last Post: 08-09-2011, 09:40 AM -
How can I save so the all my closed methods remain closed when exiting?
By Addez in forum EclipseReplies: 1Last Post: 01-31-2010, 03:17 AM -
if any user disables the browser's scripting execution then how can I know?
By vishnujava in forum JavaServer Pages (JSP) and JSTLReplies: 5Last Post: 08-06-2008, 06:21 PM -
Socket Closed!
By rameshraj in forum NetworkingReplies: 0Last Post: 05-06-2008, 10:11 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks