If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Warn the user if thier session is about to end.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-11-04, 12:26
Wigz Wigz is offline
Registered User
 
Join Date: Feb 2003
Location: Denver, CO
Posts: 34
Warn the user if thier session is about to end.

Anyone know an easy way to pop a warning if a user's ASP session is about to end? Thanks!
__________________
-Wigz

------------------------------------------------
docendo discimus.
Reply With Quote
  #2 (permalink)  
Old 05-11-04, 14:07
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
The session expires after a certain amount of inactivity. So you could either write some JavaScript to redirect the page to a logout page, or a META refresh that does the same. You could even use a combination of both. Use JS to pop up a message 5 minutes before the timeout, then use the META refresh to redirect to the logout page.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #3 (permalink)  
Old 05-11-04, 14:19
Wigz Wigz is offline
Registered User
 
Join Date: Feb 2003
Location: Denver, CO
Posts: 34
So I just have a JavaScript function count to like 19 mins 30 seconds (30 seconds before the default ASP session ends) and then pop a window asking if the user needs more time?

There is no native ASP method to determine if a session is about to end or has ended?
__________________
-Wigz

------------------------------------------------
docendo discimus.
Reply With Quote
  #4 (permalink)  
Old 05-11-04, 14:29
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Right.. make sure you make the popup window a browser popup.. I don't think the browser will redirect if you use a javascript alert() message box and it is still active when the page needs to be redirected.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #5 (permalink)  
Old 05-11-04, 14:30
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Oh.. if they click "Ok" from the popup window, you'll need to refresh the original page to restart the counter (or use the JS to restart it).
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #6 (permalink)  
Old 05-12-04, 11:08
rhs98 rhs98 is offline
Super Moderator
 
Join Date: Feb 2002
Location: Hampshire, UK
Posts: 441
Quote:
Originally Posted by Seppuku
Right.. make sure you make the popup window a browser popup..
Was going to say - if the popup was a page from your server it would extend the session - as the server would not know that it was the javascipt requesting the page or the user.

Quote:
Originally Posted by Seppuku
I don't think the browser will redirect if you use a javascript alert() message box and it is still active when the page needs to be redirected.
Don't think so either.
Reply With Quote
  #7 (permalink)  
Old 05-12-04, 19:36
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
Quote:
Originally Posted by rhs98
Was going to say - if the popup was a page from your server it would extend the session - as the server would not know that it was the javascipt requesting the page or the user.
Very true... you'd have to have some JS on that popup that counted down and redirected the parent page to the logout page (which kills the session) if the time elapses, then closed itself.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
  #8 (permalink)  
Old 05-12-04, 22:03
sundialsvcs sundialsvcs is offline
Registered User
 
Join Date: Oct 2003
Posts: 706
Given the "memory-less" nature of the HTML protocol, the way I'd probably try to approach the problem is by sending the user a javascript which sets a timer and then reacts to it. So the user's computer is the one that actually generates the warning that the session is about to expire.

It would be difficult, I think, to have the server computer generate the warning.
__________________
ChimneySweep(R): fast, automatic
table repair at a click of the
mouse! http://www.sundialservices.com
Reply With Quote
  #9 (permalink)  
Old 05-13-04, 00:48
Seppuku Seppuku is offline
Useless...
 
Join Date: Jul 2003
Location: SoCal
Posts: 721
I believe that's what we're saying.. a JavaScript timer on the client side would popup another browser window with a warning when time elapsed. That popup window would have another timer that would redirect the parent to a page that kills the session and closes itself if that second timer elapses.
__________________
That which does not kill me postpones the inevitable.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On