Hi,

I'm creating a membership style website and I have set the session timeout to 10 minutes (for now).

Ho do I redirect the user to a certain page (automatically) if the session has timeded out ?

For example... For some online banking if you login and leave the computer for e.g.. 5 mins. it automatically redirects you to a different page notifying you that you have been logged out.

Any Ideas?

Thanks. :)

ps. Session_OnEnd in the global.asa doesn't redirect.

the easiest way is to put a response.redirect in the header of the page with the delay set to the same timeout (10 minutes in your case). Everytime the page loads after 10 minutes it will redirect the user to the page.
If the user submits something and refreshes the page it will start again as the page reloads (be careful if using ajax though!).
The other way is to use a timer to do the same thing.
The third and the best but also the more complex way is to use ajax and server callbacks.

Thanks.

I see the small problem though, if i use a timer and the user is working on the page without refreshing it, it will still redirect them, but it has given me some ideas.

:)

if you use a javascript timer and keep a reference to it in javascript you can run client side code on your controls to reset the timer if they make a keypress.

var timer = setTimeout(redirectfunction,600000);
redirectfunction
{
.....
}
function resetTimer()
{
clearTimer(timer);
 setTimeout(redirectfunction,600000);
}

<html code>
....
<input type="text" onblur="resetTimer()">...etc.

ha, that would take too long.

What i could do is put the whole page in a div tag and use...

<div onMousemove="dothis();">

Thanks for the help. :cheesy:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.