Solved

Removing Session Variables on Leaving site.

Posted on 2012-03-10
3
330 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

635 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