Hi everyone,
I need some help (may be in the form of some sample code) for the subject
question.
I have an ASP.NET/C# application. I need to do quite a few tasks when the
session ends. I don't want to depend on the session timeout factor since it
may end too soon or it may hang around too long. I can't find any event
that fires when the browser closes. The Session_End event handler in the
Global.asax does not execute until the timeout value expires. Also, when it
does execute the Session_end, it seems that the session has already ended
and so, I have no access to any of the session variables I was holding onto.
Can anybody tell me the server side sequence of events and their handlers
that get called when the user closes a browser? Does the browser inform the
server that it is closing, so that I can do my cleanup?
Any help is highly appreciated.
Babu. 5 9127
Unfortunatly, nothing happens on the server when the browser is closed.
I'm afraid that you can't close the session without waiting the timeout and
the "Session_En d" event.
Lionel.
"news.microsoft .com" <ba************ @yahoo.com> a écrit dans le message de
news: uB************* @TK2MSFTNGP15.p hx.gbl... Hi everyone,
I need some help (may be in the form of some sample code) for the subject question.
I have an ASP.NET/C# application. I need to do quite a few tasks when the session ends. I don't want to depend on the session timeout factor since it may end too soon or it may hang around too long. I can't find any event that fires when the browser closes. The Session_End event handler in the Global.asax does not execute until the timeout value expires. Also, when it does execute the Session_end, it seems that the session has already ended and so, I have no access to any of the session variables I was holding onto.
Can anybody tell me the server side sequence of events and their handlers that get called when the user closes a browser? Does the browser inform the server that it is closing, so that I can do my cleanup?
Any help is highly appreciated.
Babu.
Thanks for the reply, Lionel. That was fast!
OK, then, is there another event that fires before the call to the
Session_End handler in the Global.asax? Because by the time the execution
arrives at this handler, I have no access to any of the Session variables
(It seems that the session has already been removed). If only I could find
an event that fires with the session state intact just before the session
closes.
Babu.
"Lionel LASKE" <ll****@c2s.f r> wrote in message
news:es******** ******@TK2MSFTN GP14.phx.gbl... Unfortunatly, nothing happens on the server when the browser is closed. I'm afraid that you can't close the session without waiting the timeout and the "Session_En d" event.
Lionel.
"news.microsoft .com" <ba************ @yahoo.com> a écrit dans le message de news: uB************* @TK2MSFTNGP15.p hx.gbl... Hi everyone,
I need some help (may be in the form of some sample code) for the subject question.
I have an ASP.NET/C# application. I need to do quite a few tasks when the session ends. I don't want to depend on the session timeout factor since it may end too soon or it may hang around too long. I can't find any event that fires when the browser closes. The Session_End event handler in the Global.asax does not execute until the timeout value expires. Also, when it does execute the Session_end, it seems that the session has already ended and so, I have no access to any of the session variables I was holding onto.
Can anybody tell me the server side sequence of events and their handlers that get called when the user closes a browser? Does the browser inform the server that it is closing, so that I can do my cleanup?
Any help is highly appreciated.
Babu.
re: Unfortunatly, nothing happens on the server when the browser is closed.
Right.
re: I'm afraid that you can't close the session without waiting the timeout and the "Session_En d" event.
You can programmaticall y call Session.abandon
to force the end of a session at any time.
That won't help Babu at all, but ending the session *can* be
done without the need to wait for the timeout or Session_End.
One way to persist session values, so they're restored the next
time the visitor returns, would be to dump the session values into
a cookie named with the SessionID. Each time you add a Session
variable, you add a cookie key with the variable's value.
When the user returns, reading the cookie would enable
you to set the same values to the current session.
Alternately, you could dump the session values into a db table,
using the SessionID as the key. Then, reading a simple cookie
set with a key name = SessionID would allow you to set the
current session values to the previous session values.
Why you'd want to do that beats me, but it's not too hard to do.
Juan T. Llibre
ASP.NET MVP
===========
"Lionel LASKE" <ll****@c2s.f r> wrote in message
news:es******** ******@TK2MSFTN GP14.phx.gbl... Unfortunatly, nothing happens on the server when the browser is closed. I'm afraid that you can't close the session without waiting the timeout and the "Session_En d" event.
Lionel.
"news.microsoft .com" <ba************ @yahoo.com> a écrit dans le message de news: uB************* @TK2MSFTNGP15.p hx.gbl... Hi everyone,
I need some help (may be in the form of some sample code) for the subject question.
I have an ASP.NET/C# application. I need to do quite a few tasks when the session ends. I don't want to depend on the session timeout factor since it may end too soon or it may hang around too long. I can't find any event that fires when the browser closes. The Session_End event handler in the Global.asax does not execute until the timeout value expires. Also, when it does execute the Session_end, it seems that the session has already ended and so, I have no access to any of the session variables I was holding onto.
Can anybody tell me the server side sequence of events and their handlers that get called when the user closes a browser? Does the browser inform the server that it is closing, so that I can do my cleanup?
Any help is highly appreciated.
Babu.
Babu,
You do have some limited possibilities. You can use
Response.IsClie ntConnected. Google for it to find out how it can help.
Eliyahu
"news.microsoft .com" <ba************ @yahoo.com> wrote in message
news:uB******** *****@TK2MSFTNG P15.phx.gbl... Hi everyone,
I need some help (may be in the form of some sample code) for the subject question.
I have an ASP.NET/C# application. I need to do quite a few tasks when the session ends. I don't want to depend on the session timeout factor since
it may end too soon or it may hang around too long. I can't find any event that fires when the browser closes. The Session_End event handler in the Global.asax does not execute until the timeout value expires. Also, when
it does execute the Session_end, it seems that the session has already ended and so, I have no access to any of the session variables I was holding
onto. Can anybody tell me the server side sequence of events and their handlers that get called when the user closes a browser? Does the browser inform
the server that it is closing, so that I can do my cleanup?
Any help is highly appreciated.
Babu.
write session.RemoveA ll()in the following code
Sub Application_End (ByVal sender As Object, ByVal e As EventArgs)
' Fires when the application ends
Session.RemoveA ll()
End Sub
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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
|
by: LordHog |
last post by:
Hello all,
I am a small application that I am developing which will use a few
threads. When the user closes the form the threads will remain present
until I close them. The Main Form instantiates a couple of
communications classes which contain the threads. So for this
communications class should I provide some sort of close/kill/terminate
method or should I provide a dispose() function to terminate the
threads? Thanks for any insight.
|
by: Robert V. Hanson |
last post by:
If you have per user information that you want to store in session and the
setting in web.config is set to cookieless=false so you are intending on
using cookies, the user's browser is set to not accept cookies, what can you
do as alternative for storing that data?
What is the tradeoff if you just set the cookieless=true?
I am just trying to determine a set of best practices for this on my
project.
|
by: feng |
last post by:
Hi,
When user closes a browser window by clicking on the "X"
button, I want the server to be noticed (either through
postback or calling other ASP pages, etc.) and perform
some task accordingly. Please note that I can't use
session end event, since the session is still alive now
and the user is just closing a secondary window he/she
opened.
|
by: Keith-Earl |
last post by:
I thought for sure Session End would fire when the user closes his browser,
but no luck. The only way I can get the event to fire is to run a
Session.Abandon, but is that really practicle? When a user is down they
will probably close out the browser or navigate somewhere else.
I want to keep a total count of users in an Application state variable but I
cannot count on the decrement code to run. What can I do to keep up with
Total Users...
| |
by: Charlie |
last post by:
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
|
by: =?Utf-8?B?RGVhbiBHYXJyZXR0?= |
last post by:
I'm writing a .NET 2.0 app that needs to manage user sessions. We're using
SQL Server 2005 tables to hold sessions status fields in a table. The
problem is how to handle the situation where a user closes the browser
without logging out first. We're using our own authentication, not Windows.
We'd like to somehow log the user out and free up the user seat? There
doesn't seem to be a method in .net to capture the browser close event.
How...
|
by: spoonybard |
last post by:
Hi Everyone,
I have a .Net 2.0 C# web application that has important information stored in Sessions that needs to be deleted when the user closes the browser. I know of three ways a user can close their browser:
Presses "X" button in top right of browser
Presses Alt-F4
From browser menu selects File -> Close
With javascript I am able to detect that the user presses the X button. Since Javascript is client side and ASP.Net is server...
|
by: gsherp |
last post by:
How does one execute code when the user closes the browers window by clicking on the top right corner . I need to log out user and do a database write when the user closes the brower. I do these to clean up the database when the user exits before actually logging out.
I was told to user pageX, but does not seem to work either. Again, I am having trouble with firefox.
Thanks.
|
by: chazzy69 |
last post by:
Basically i was wondering how to open a popup window, when the user closes either a website i.e. leaving the website; or closes the entire browser.
Thanks for any help
|
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...
| |
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,...
|
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...
|
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,...
|
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...
|
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...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |