Forum Moderators: open

Message Too Old, No Replies

global.asa Session OnEnd alert

global.asa Session_OnEnd alert

         

fototex

9:14 pm on Jan 13, 2010 (gmt 0)

10+ Year Member



Hi friends,

I am trying to edit my global.asa such that it sould pop up an alert to the user whenever the users session expires.

Could not find what line to add to the file.

Thank you for your comments.

Ocean10000

11:43 pm on Jan 13, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Unless the person still has the browser open to one of the pages on that site its not possible to do (show a message that is). I seen it done with javascript which has a two simple timers. (1) it hits zero it pop's up a warning saying the session is about to time out. (2) runs longer then the first, and when it hits zero it redirects to the logoff page (logoff destroys the session).

fototex

8:02 pm on Jan 14, 2010 (gmt 0)

10+ Year Member



Hi Ocean10000,

This is a good idea too but what about the global.asa?
Is it not possible to do this with global.asa?

Seb7

8:53 pm on Jan 14, 2010 (gmt 0)

10+ Year Member



Its difficult to use this route, as you would need to get the page to constantly ping the website, the global.asa to set application variables when expired, and then to also remove the variables once the information reaches the browser.

A much easier and sensible method (which I've previously done), is to have your pages reference a javascript which is timed to popup a message about 1min before the session is set to expire.

Here's a cruide untested example:
var t=window.setTimeout("if (confirm('continue session?')){window.reload}",1100000)

fototex

6:35 pm on Jan 16, 2010 (gmt 0)

10+ Year Member



Ok seb7, great idea but not sure how to use that variable "t" within the page.

fototex

12:05 pm on Jan 17, 2010 (gmt 0)

10+ Year Member



Ok I've entered the code as it is. Now the message pops up but when the selection is ok, nothing happens. (The page does not refresh itself).
The code:

window.setTimeout("if (confirm('continue session?')){ window.reload }",5000) ;

Seb7

9:39 pm on Jan 18, 2010 (gmt 0)

10+ Year Member



This should work better..

var t=window.setTimeout("if (confirm('continue session?')){window.location.reload()}else{location='logout.php'}",5000)

Ignore the var t, its only there to collect the timer object reference which is useful if you want to cancel the timeout.