Trap BrowserClose event so can Logout Session

R

Ron J

How can I trap the user just closing the browser (upper right [x]) so I can
shutdown the Asp.net session properly. Don't really want to wait for the
default timeout to occur. I'm using a Master page so it should be easy to
logout once I know how to catch the event. Thanks.
 
M

Mark Rae [MVP]

How can I trap the user just closing the browser (upper right [x])

You can't.

This question comes up regularly - there are usually several suggestions,
mainly centering around the onunload event of the <body> tag - none of them
even half works.

Don't waste any time on this - it isn't possible, otherwise every website in
the world would be doing it...
 
R

Ron J

Thanks Mark. Fair enough. Perhaps you can suggest another way to do this:
User logs in at one station.
They move to another station and want to login.
We don't want concurrent logins from different stations.
-how do I logout the first one? I know timeout but thats 20minutes.

Mark Rae said:
How can I trap the user just closing the browser (upper right [x])

You can't.

This question comes up regularly - there are usually several suggestions,
mainly centering around the onunload event of the <body> tag - none of
them even half works.

Don't waste any time on this - it isn't possible, otherwise every website
in the world would be doing it...
 
G

Guest

I suppose you could store the remote IP Address of the machine when they
first log in (you could store it in Cache with a key that matches the
username).

So if you look at the UserHostAddress inside Application_AuthenticateRequest
and compare, that would be one way to do it.
-- Peter
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com



Ron J said:
Thanks Mark. Fair enough. Perhaps you can suggest another way to do this:
User logs in at one station.
They move to another station and want to login.
We don't want concurrent logins from different stations.
-how do I logout the first one? I know timeout but thats 20minutes.

Mark Rae said:
How can I trap the user just closing the browser (upper right [x])

You can't.

This question comes up regularly - there are usually several suggestions,
mainly centering around the onunload event of the <body> tag - none of
them even half works.

Don't waste any time on this - it isn't possible, otherwise every website
in the world would be doing it...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top