Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   How can I make sure that Session_End is called when the user closes the browser? (http://www.velocityreviews.com/forums/t109729-how-can-i-make-sure-that-session_end-is-called-when-the-user-closes-the-browser.html)

Annie 09-13-2005 09:59 AM

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



JIMCO Software 09-13-2005 12:05 PM

Re: How can I make sure that Session_End is called when the user closes the browser?
 
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





Hans Kesting 09-13-2005 12:10 PM

Re: How can I make sure that Session_End is called when the user closes the browser?
 
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



KMA 09-13-2005 12:55 PM

Re: How can I make sure that Session_End is called when the user closes the browser?
 
which is why ebanking software has a "log out" button, so it can call
session abort.

"Hans Kesting" <news.2.hansdk@spamgourmet.com> wrote in message
news:eNa9SwFuFHA.3068@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
>
>




Annie 09-14-2005 05:36 AM

Re: How can I make sure that Session_End is called when the user closes the browser?
 
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" <myjunksandforums@gmail.com> wrote in message
news:4326a30a$1@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
>
>




JIMCO Software 09-14-2005 12:05 PM

Re: How can I make sure that Session_End is called when the user closes the browser?
 
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





JIMCO Software 09-14-2005 12:08 PM

Re: How can I make sure that Session_End is called when the user closes the browser?
 
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






All times are GMT. The time now is 04:05 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.