473,659 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Abando n()) when user clicks "x"?

Thanks,
Charlie
Nov 19 '05 #1
3 2572
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@NI SH" <cf*******@nish .org> wrote in message
news:uS******** ******@TK2MSFTN GP12.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.Abando n()) 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@NI SH" <cf*******@nish .org> wrote in message
news:uS******** ******@TK2MSFTN GP12.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.Abando n()) when user clicks "x"?

Thanks,
Charlie


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

"wbrianwhit e" <wb*********@di scussions.micro soft.com> wrote in message
news:B6******** *************** ***********@mic rosoft.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@NI SH" <cf*******@nish .org> wrote in message
news:uS******** ******@TK2MSFTN GP12.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.Abando n()) 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
19073
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 password can enter in the system. as he signs out database was updated but the problem is if somehow he forgot to sign out and closed the browser or navigate to other page or site his information was still on in the database. I want a solution how...
9
3635
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 for my session variable based security scheme. Basically, the risk is that a user will login to my site, close the window when done and allow someone else to come up to the machine, go back to my site and be logged into the previous user's...
1
7972
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 : VBScript and Javascript Client : 1. IE browser. 2. VBForm embedded with WebBrowser control (MS Internet
4
4200
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 write to close the session or does it get killed when the user is closes their browser? Please advise. rafael
11
5066
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 the site, the shopping cart information is there! The shopping cart info is only loaded into a session variable! There are no cookies on the site to store this information. Am I mistaken in believing when a browser window is closed that the session...
3
7185
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 click event of this button I clear my Session variables. However, how can I capture the fact that the page has been finished with, to clear my session variables, if the user (a) navigates away from the page directly by entering a URL, (b)...
5
1951
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 would like to delete the file. I was thinking to check for the session variable in the global.asax.vb in the session_end. However when I close the pdf the session_end is never called. Is there any way to do that?
5
548
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 users or save any data. If the application crashes or user exits the program they should simply start again. Pretty basic. All interactions are stored in an array (not much going on to save to a
16
1832
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, although I do not understand what they do. Can anyone tell me if it's possible for a recycled session to still contain the old data? I had a couple of reports that where users said they logged on and saw another user's data. On this site, there...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8747
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8528
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8627
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2752
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.