User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 402,375 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,052 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 4375 | Replies: 4
Reply
Join Date: Jan 2007
Posts: 7
Reputation: bubbliciousbar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
bubbliciousbar bubbliciousbar is offline Offline
Newbie Poster

Help ASP Redirect on Session Timeout

  #1  
Mar 23rd, 2007
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2006
Location: Its the internet... i am everywhere lol
Posts: 274
Reputation: f1 fan is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 10
f1 fan f1 fan is offline Offline
Posting Whiz in Training

Re: ASP Redirect on Session Timeout

  #2  
Mar 23rd, 2007
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.
Reply With Quote  
Join Date: Jan 2007
Posts: 7
Reputation: bubbliciousbar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
bubbliciousbar bubbliciousbar is offline Offline
Newbie Poster

Re: ASP Redirect on Session Timeout

  #3  
Mar 23rd, 2007
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.

Reply With Quote  
Join Date: Jan 2006
Location: Its the internet... i am everywhere lol
Posts: 274
Reputation: f1 fan is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 10
f1 fan f1 fan is offline Offline
Posting Whiz in Training

Re: ASP Redirect on Session Timeout

  #4  
Mar 23rd, 2007
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.
Reply With Quote  
Join Date: Jan 2007
Posts: 7
Reputation: bubbliciousbar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 1
bubbliciousbar bubbliciousbar is offline Offline
Newbie Poster

Re: ASP Redirect on Session Timeout

  #5  
Mar 23rd, 2007
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:
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 12:44 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC