473,244 Members | 1,690 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,244 software developers and data experts.

Cancelling session when user closes browser window...

Hi:

I would like to clear session when user closes browser window by clicking
the "x" in upper right hand corner. Since this is a client side event, how
do I run server code (Session.Abandon()) when user clicks "x"?

Thanks,
Charlie
Nov 19 '05 #1
3 2550
The only way would be to trap the onbeforeunload client side event using
javascript, and then make a call to the server to kill the session. The
issue here is that this event is always raised, even if the user is just
browsing to another page on your site - so you need to make sure you only
kill the session at the right time.

"Charlie@NISH" <cf*******@nish.org> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
Hi:

I would like to clear session when user closes browser window by clicking
the "x" in upper right hand corner. Since this is a client side event,
how do I run server code (Session.Abandon()) when user clicks "x"?

Thanks,
Charlie

Nov 19 '05 #2
You can never catch this completely. You can use javascript to handle the
person navigating somewhere, but there isn't any way to catch it when the
user simply exits their browser.

"Marina" wrote:
The only way would be to trap the onbeforeunload client side event using
javascript, and then make a call to the server to kill the session. The
issue here is that this event is always raised, even if the user is just
browsing to another page on your site - so you need to make sure you only
kill the session at the right time.

"Charlie@NISH" <cf*******@nish.org> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
Hi:

I would like to clear session when user closes browser window by clicking
the "x" in upper right hand corner. Since this is a client side event,
how do I run server code (Session.Abandon()) when user clicks "x"?

Thanks,
Charlie


Nov 19 '05 #3
I believe this event will run even when the browser is closed.

"wbrianwhite" <wb*********@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com...
You can never catch this completely. You can use javascript to handle the
person navigating somewhere, but there isn't any way to catch it when the
user simply exits their browser.

"Marina" wrote:
The only way would be to trap the onbeforeunload client side event using
javascript, and then make a call to the server to kill the session. The
issue here is that this event is always raised, even if the user is just
browsing to another page on your site - so you need to make sure you only
kill the session at the right time.

"Charlie@NISH" <cf*******@nish.org> wrote in message
news:uS**************@TK2MSFTNGP12.phx.gbl...
> Hi:
>
> I would like to clear session when user closes browser window by
> clicking
> the "x" in upper right hand corner. Since this is a client side event,
> how do I run server code (Session.Abandon()) when user clicks "x"?
>
> Thanks,
> Charlie
>


Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: megha | last post by:
Hi I am writing a program in JSP which requires user to log in and as he logs in database was updated with his status on and till the user does not sign out no other user with same login and...
9
by: Pack Fan | last post by:
I've noticed that session variables will persist on Mac IE even after all browser windows have been closed. One must quit the program to clear the session variables. This presents a security risk...
1
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script :...
4
by: Rafael Chemtob | last post by:
Hi, I'm using session cookies on my web app and it looks like the session is not being killed when the user closes the browser. We use a Global.asa file on our app. Do we have to explicitly...
11
by: David Lozzi | last post by:
Hello All, I am having an issue with thus far one computer on my client's web site. If the user loads the shopping cart and then closes all browser windows, then opens them back up, goes back to...
3
by: JezB | last post by:
I want to clear some specific Session variables when the user closes a page. On my page I have a "return to ..." button which navigates back to the parent page from which it was invoked - under the...
5
by: anonmous | last post by:
Hello, I am creating a pdf via some code. Now when the pdf is created, I assign the filename to a session variable and open a new window with the pdf. Now when the user closes the pdf window, I...
5
by: Sean | last post by:
Problem with sessions I have created an application without concern for sessions. As it turns out I think that might be my undoing. What I have: I have an online quiz. I don’t need to know...
16
by: Jonathan Wood | last post by:
Greetings, I was wondering if anyone here has a good understaning of the Session object. I know there are options like the Session.Abandon method and the regenerateExpiredSessionId setting,...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.