Hi all. I have issue about multiple login in asp.net. Case this happen: User X login as "user1" in web browser. Then user Y also login as "user1" also in another web browser. User Y got error message "Another user log in some account". That is work as expected. If X, close their web browser. Then try again to login in as "user1". X get also get "Another user log in some account". So i trying debug then i found session is remove when web browser is close, but cache still remaining in web browser. Anyone have idea about this how to clear cache when user close their browser, (not tab). Regard.
A:
There is no reliable way to get a notification when the browser is closed.
The best you can do is get notification that it's still open and implement your own timeout. Use an ajax callback on a timer to ping the server "I'm still open". Set it to every 5 or 10 or 30 seconds or whatever you need and when you don't get one on the server for that time, you know the browser was closed.
Sam
2010-10-13 01:45:34
Isn't this called "Reverse AJAX" or something? (just curious)
RPM1984
2010-10-13 03:13:52
@RPM1984, no, "Reverse ajax" aka "Comet" aka "long polling" are a method of sending data from server to client on-demand. Since in this case aren't interested in sending data back down from the server to the client, there is no need to keep the connection open.
Sam
2010-10-13 16:58:47