Solved

Expiring of Sessions in ASP.NET

Posted on 2004-10-13
8
417 Views
Last Modified: 2010-04-06
In ASP.NET after having set the Session timeout to 20 minutes, if the users close the browser window without logging out , is there a way to identify such clients from the Server without having to wait for 20 minutes and expiring those sessions?
0
Comment
Question by:ravisankar1978
8 Comments
 
LVL 6

Accepted Solution

by:
etmendz earned 100 total points
ID: 12296140
The web is stateless. And because of that, the feature you want is not possible. Have fun...
0
 
LVL 2

Assisted Solution

by:AmanBrar
AmanBrar earned 100 total points
ID: 12297146
There is no way to do that from a server.
Maybe u can do that in the application's unload function.
0
 
LVL 53

Assisted Solution

by:COBOLdinosaur
COBOLdinosaur earned 100 total points
ID: 12297534
The only way to do it is with client side code.  You can use a hidden frame or iframe with a function that sends accross a refresh request on a regular basis; say every minute of 30 seconds.  When the refresh messages quit coming th user has move off with out logging off and you can expire the session.

Cd&
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 2

Assisted Solution

by:mikelima
mikelima earned 100 total points
ID: 12311465
When drawing a page, pass a variable to it: if it is a form, include dynamically a hidden field called, for example, time, containing the hour when the page was dynamically drawn. If the page is not a form, pass a variable to it on the url (something like page.asp?time=1005.

At the beginning of all pages you want to expire, put a routine to verify the time on that variable with the time on server and expire it when desired.
0
 
LVL 2

Assisted Solution

by:poopall
poopall earned 100 total points
ID: 12336449
Why dont you reduce the sesson time out to say 5 minutes, if they are using the site then the session will remain valid, if they stop using it they will have to login in again.



0
 
LVL 2

Expert Comment

by:poopall
ID: 12336451
Another way would be for you to set up some client side javascript that acts like a hearbeat if the page is still loaded into the browser window, if the hear beat stops for that user, expire their login
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

25 Experts available now in Live!

Get 1:1 Help Now