I've been playing with this for a while...maybe it'll help

Create an include file, or add this code to an include file that's in the
pages where you need the timeout...

Whatever the session timeout setting is say 10 mins 
Response.write out the open and close script tags and javascript function.

BEGIN SCRIPT TAG

function TimeOutUser(){
  window.location.href="page to goto on timeout"
}

function ResetTimer(){
    window.clearTimeout(logoutTimer)
    var eventTime = new Date()
    logoutTimer = window.setTimeout('TimeOutUser()', 600000)
}
END SCRIPT TAG

In the body tag put an onLoad="ResetTimer()"

So the timer gets reset when the page loads, you just have to remember that
the javascript time is in milliseconds, so you have to multiply up from
minutes..

Each time the user goes to a new page, the js timer is reset, and so is the 
session timer on the server (there may be a difference of a couple of
seconds depending how long it takes the pages to load) so both are just
about in sync.







-----Original Message-----
From: Chris Tifer [mailto:christ@;saeweb.com] 
Sent: Monday, November 04, 2002 1:07 PM
To: ActiveServerPages
Subject: Re: Session _OnEnd

The server doesn't send an event to the browser. Would be
nice in theory if it did.  So putting a redirect in the OnEnd event
will not work, and probably did not work for those who you
said you saw put in their pages.

Chris Tifer
Mic Club - The Curriculum / Nov. 19th


----- Original Message -----
From: "Imad Jradi" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Monday, November 04, 2002 12:57 PM
Subject: RE: Session _OnEnd


> Thanls for the reply.
> I have see people insert redirect in the session_onend sub. I don't knwo
if
> it worked for them. I am using a refresh in my header, but I just that I
> could do that on the server when the session times out.
> Imad
>
>
> >From: "Timothy Owen" <[EMAIL PROTECTED]>
> >Reply-To: "ActiveServerPages" <[EMAIL PROTECTED]>
> >To: "ActiveServerPages" <[EMAIL PROTECTED]>
> >Subject: RE: Session _OnEnd
> >Date: Sun, 3 Nov 2002 18:57:14 -0600
> >
> >response.redirect is used in code execution when the browser requests
> >something.  To do what you are attempting I believe you will need to use
> >browser executed vb or javascript.
> >
> >-----Original Message-----
> >From: Imad Jradi [mailto:jradi@;hotmail.com]
> >Sent: Sunday, November 03, 2002 6:36 PM
> >To: ActiveServerPages
> >Subject: Session _OnEnd
> >
> >I set the session timeout in my Session_OnStart sub, and that works
> >fine. I
> >need to redirect the user to the logout page when the session times out.
> >
> >When I inserted the response.redirect in my Session_OnEnd, I kept
> >getting
> >Response object error. Any ideas?
> >Thanks
> >
> >
> >
> >
> >
> >
> >_________________________________________________________________
> >Get a speedy connection with MSN Broadband. Join now!
> >http://resourcecenter.msn.com/access/plans/freeactivation.asp
> >
> >
> >---
> >You are currently subscribed to activeserverpages as:
> >[EMAIL PROTECTED]
> >To unsubscribe send a blank email to
> >%%email.unsub%%
> >
> >
> >---
> >You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
> >To unsubscribe send a blank email to
> >%%email.unsub%%
>
>
> _________________________________________________________________
> Internet access plans that fit your lifestyle -- join MSN.
> http://resourcecenter.msn.com/access/plans/default.asp
>
>
> ---
> You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to