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

How can I make sure that Session_End is called when the user closes the browser?

Hi guys,

I just want to do some clean up in the Session_End at Global.aspx.

However, if the user closes the browser window that event is not fired.

how can I call explicity protected void Session_End(Object sender, EventArgs
e)
when the user closes the browser window?

possible at all?

TA
Nov 19 '05 #1
6 2083
Annie wrote:
Hi guys,

I just want to do some clean up in the Session_End at Global.aspx.

However, if the user closes the browser window that event is not
fired.
how can I call explicity protected void Session_End(Object sender,
EventArgs e)
when the user closes the browser window?


Not possible. You're working with a connectionless architecture. The
server has no knowledge of when the user closes their browser.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #2
Annie wrote:
Hi guys,

I just want to do some clean up in the Session_End at Global.aspx.

However, if the user closes the browser window that event is not
fired.
how can I call explicity protected void Session_End(Object sender,
EventArgs e)
when the user closes the browser window?

possible at all?

TA


The session does not end when the user closes the browser, but (default)
20 minutes after the last request to the site. (So if he was busy for 30 minutes
reading a single page, the session would have ended).

There is no (reliable) way to detect that the user has closed the browser,
navigated away from the site, or lost his internet connection.

Hans Kesting
Nov 19 '05 #3
KMA
which is why ebanking software has a "log out" button, so it can call
session abort.

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:eN**************@TK2MSFTNGP14.phx.gbl...
Annie wrote:
Hi guys,

I just want to do some clean up in the Session_End at Global.aspx.

However, if the user closes the browser window that event is not
fired.
how can I call explicity protected void Session_End(Object sender,
EventArgs e)
when the user closes the browser window?

possible at all?

TA
The session does not end when the user closes the browser, but (default)
20 minutes after the last request to the site. (So if he was busy for 30

minutes reading a single page, the session would have ended).

There is no (reliable) way to detect that the user has closed the browser,
navigated away from the site, or lost his internet connection.

Hans Kesting

Nov 19 '05 #4
wow gettting very interesting!
How about catching it in client side using Javascript and something and
passing it to server somehow?
not possible at all?
"Annie" <my**************@gmail.com> wrote in message
news:43********@dnews.tpgi.com.au...
Hi guys,

I just want to do some clean up in the Session_End at Global.aspx.

However, if the user closes the browser window that event is not fired.

how can I call explicity protected void Session_End(Object sender,
EventArgs e)
when the user closes the browser window?

possible at all?

TA

Nov 19 '05 #5
Annie wrote:
wow gettting very interesting!
How about catching it in client side using Javascript and something
and passing it to server somehow?
not possible at all?


Sessions use a sliding expiration. That means that as soon as you "pass it
on to the server", you reset your Session expiration, thereby delaying the
execution of Session_End, not expediting it.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #6
Annie wrote:
wow gettting very interesting!
How about catching it in client side using Javascript and something
and passing it to server somehow?
not possible at all?


Hit Send too soon. :)

Of course you could have your browser call a page that calls
Session.Abandon, but you have to remember that there is no way to hook a
client side event ONLY when the browser is closed. It would be impossible
(as far as I can think right off this early in the AM) to detect the browser
closing correctly.

One more thing to add. Session_End is indeterminate. Even if you call
Session.Abandon, you cannot guarantee when Session_End will get called.

--
Jim Cheshire
JIMCO Software
http://www.jimcosoftware.com

FrontPage add-ins for FrontPage 2000 - 2003


Nov 19 '05 #7

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

Similar topics

2
by: Chris Sibel | last post by:
Hey guys I have a user tracking setup to track users. What it does is once a user hits my site it sends me an email telling me some info and once a user clicks the logout button it sends a second...
5
by: JezB | last post by:
Why is my Session_End event in global.asax never firing ? I've tried fiddling with the timeouts but still nothing. Ideally I want to do some processing whenever someone leaves my web application...
3
by: MattB | last post by:
Hi. I have a couple of questions regarding the Session_End event. I have some clean-up code in this event and it does fire when the session times out, which is good. I also want to have this (or...
1
by: Timo | last post by:
A few questions relating to sessions ending. 1. What happens to the session when a user closes the browser? Does the session remain alive until it times out? 2. In the Session_End...
2
by: sundar_s1210 | last post by:
I am doing a Shop Cart application In my asp.net application, i want to delete some records from database when user closes the browser without purchasing the product which is added to shop cart....
0
by: rsford31 | last post by:
I have an application where users are assigned roles: control (can edi items, delete items add items), update (can update items) and read (ca only read content). When the user logs into the web...
7
by: Bruno | last post by:
We are attempting to automatically log users off from the Session_End event in global.asax and set some values on session_start. It is not a critical task, more of a housekeeping task so that we...
8
by: Roger | last post by:
When I call the session.abandon() method, it calls the session_end event. When a user closes the browser or clicks the log off button, I can dispose of objects and abandon the session cleaning....
5
by: Ron J | last post by:
I would like to keep track of users when they are 'on'. On Session_Start I can write a DB record about them, but there does not seem to be session variable information during the Session_end event...
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
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.