Solved

Removing Session Variables on Leaving site.

Posted on 2012-03-10
3
326 Views
Last Modified: 2012-03-10
On login to my website, I create a session variable. I'm trying to find out if there's a way to remove that session variable if the user leaves the web site (ie they close that browser tab or just type in a different url).

After doing some research, I'm afraid there might not be a good answer to this since there's no page request to our site when a user does that, but you guys have surprised me before.
0
Comment
Question by:Josh_Blade
3 Comments
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 500 total points
ID: 37705924
No, its not possible, the session will end when it times out - usually 20 mins. Why would you care?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 37705930
No, not on this one and people ask this all the time.  Like you said, nothing gets sent to the server under those conditions.  Normally sessions use 'session cookies' which expire when the browser is closed but not when just a tab is closed.  The session variables should expire when the session times out.  

The closest anyone has come is a javascript 'pinger' that uses AJAX to let the server know that the window for the session is still open.  What that really does is continuously reset the session timer to extend the session.
0
 

Author Closing Comment

by:Josh_Blade
ID: 37705931
The person that pays me asked me to do it. Not sure why exactly he would care. Thanks though :)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question