aspose file tools*
The moose likes Struts and the fly likes invalidating the session on closure of browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "invalidating the session on closure of browser" Watch "invalidating the session on closure of browser" New topic
Author

invalidating the session on closure of browser

sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
Hi


I have to introduce licensing framewrok to my webapplication ..which mean to say that i will give the clinet saying that u can run only 20 clients using my webapp server ........for this we need to keep track of the sessions getting created .....................

But the problem is that if the user logsout properly then license system will be informed that one user is out .........but if one user closes the browser abruptly with out logging out ......then my license system has to wait till the session of that user expires ......................

I know that windows close event cant be caught( i am sure of this i hope) ........but is there anyway of informing the server that the user has closed his browser ................

If not above is there anyway from the server to ping back to all the active sessions and findout if the browser is opened r closed and then invalidate the session.................


Any help on this would be highly appreciated
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

Have you ever been stuck in a string of pop-up ads where you close one and it opens another? It is possible.

The only thing I can think of is to use javascript to detect a window close in the pages that are only accessible to logged-in users. This detection would trigger a pop-up window to open. The pop-up's request will clean up the session on the server and send back a page telling the user that they should play nice and log out next time (even though it's taken care of).

The drawbacks to this approach is that a browser with javascript turned off or with a pop-up blocker might prevent it from working.


A good workman is known by his tools.
sreenath reddy
Ranch Hand

Joined: Sep 21, 2003
Posts: 415
hi marc

the tough thing is that how to detect the window close event is the main problem any idea on this ???
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

My suggestion is to browse the web until you get stuck in a bunch of naughty pop-ups and view the source to see what the javascript looks like.

Just kidding.

I think there is an onUnload attribute for the body tag but I am not sure which browsers support it.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: invalidating the session on closure of browser
 
Similar Threads
each time iam creating a new session
session expunged
Tomcat - sessions do not expire
Tomcat Inactive Session Management
is session different for same user