473,387 Members | 1,291 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,387 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 2556
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.