Solved

Removing Session Variables on Leaving site.

Posted on 2012-03-10
3
323 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 82

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Limiting string to two deciamls 18 36
DataGridview Currency Formating? 22 39
Get String split 5 33
C# Error - Add Failed 12 53
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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now