Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Session.timeout catch processing

Status
Not open for further replies.

olegkot

Programmer
Aug 28, 2001
31
IL
Hi!

Can I catch the session time??
Situation:
-I have multiple windows application.
-Session.timeout = 20
I'd like to: close all application windows and redirect my user to "Session time expired" page 10 seconds before the Session.timeout time.

Thx, oleg.
 
Session.timeout starts when a page is delivered from your website, and reset for each new page that is delivered from your site.

the only feasible answer I can think for this would be to time the client using Javascript, then close all the windows when it is +1190 seconds and redirect the user.

I think it would be something along a setTimeout call, but I don't like converting milliseconds so I'm not even gonna try :)

Anyways - this would need to be on every page that the user is logged into... you would need to modify the Javascript just a little bit to check for the user's logged in status

something like
<script language=&quot;javascript&quot;>
<% if userLoggedIn then %>
function watchFortimeout()
...
<%end if%>

but in theory this should work, because of the nature of the Session.timeout... and since the Javascript gets reloaded for every page, this should always be set to the correct time limit.

hth
leo
 
Hi!

The problem in your suggestion is that javascripts setTimeout function is not related to the session time in the sense that it counts absolute time and not the time of session.timeout which are different things..?

Other ideas?
 
I was asked once to do this. Here was my answer:

No

In theory, as leo has suggested, it COULD be done, but to do so would be so intensive on server resources... oh, it just gives me chills.

Think about the processing power you would eat up by running a clock (iteration) on every single logged in user that was on your site. And keeping up with when pages are served to what session and resetting if needed, etc... OUCH!

If anyone could come up with an idea on how to do it efficiently, then I would love to hear it (actually, my client would), but I gave it some thought, looked at a few different ways including checking the existence of the sessionID every so many seconds on the pages themselves, and then redirecting the second it wasn't there anymore (not real-time, but close), but the best I could tell, that would take remote scripting (which I have no experience with) combined a constantly running javascript function using setTimeout() -- which is not as intensive on the server, but more so on the client... I just don't see it happening. Moreover, I have not ever seen a site that did it...

Anyone?
penny.gif
penny.gif
 
This may be an ideea
try to use a session variable witch stores the session.timeout value whend the user first loggin and then in each page that u show to the user put a script like leo says with the nr of secs or minutes witch are left in the session variable and then put an script witch catch the onunload event witch submits to server and decrease the session variable by the time u have in client side...It may be an problem here but is an simple ideea

Hope this will be an good ideea... ________
George, M
email : shaddow11_ro@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top