Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Session Times Out.... Navigate to Login Page

Reply
Thread Tools

Session Times Out.... Navigate to Login Page

 
 
Amith Singh
Guest
Posts: n/a
 
      09-04-2004
When the sessions times out I would like to take the user to the login page.
Currently even though session times out user will come to know only when he
clicks on the screen. How to direct the user automatically to login page
once the session times out. I am using .Net Framework 1.1. and IIS 5
Amith


 
Reply With Quote
 
 
 
 
Scott Allen
Guest
Posts: n/a
 
      09-04-2004
You could force the browser to refresh after a set amount of time:

Response.AppendHeader("Refresh", (Session.Timeout * 60 +
10).ToString() + "; URL=Login.aspx");

This will calculate the time to refresh using the Session timeout
value on the server (specified in minutes).

HTH,

--
Scott
http://www.OdeToCode.com

On Sat, 4 Sep 2004 11:14:52 -0700, "Amith Singh"
<(E-Mail Removed)> wrote:

>When the sessions times out I would like to take the user to the login page.
>Currently even though session times out user will come to know only when he
>clicks on the screen. How to direct the user automatically to login page
>once the session times out. I am using .Net Framework 1.1. and IIS 5
>Amith
>


 
Reply With Quote
 
 
 
 
Rutger Smit
Guest
Posts: n/a
 
      09-04-2004
Amith Singh wrote:

> When the sessions times out I would like to take the user to the login page.
> Currently even though session times out user will come to know only when he
> clicks on the screen. How to direct the user automatically to login page
> once the session times out. I am using .Net Framework 1.1. and IIS 5
> Amith
>
>


Run a cli9ent sided time somwhere somehow and when I reaches the 20
minutes (default session timeout setting) you do something like a popup,
redirect, etc.

--

//Rutger

http://www.velocityreviews.com/forums/(E-Mail Removed)
www.RutgerSmit.com
 
Reply With Quote
 
Rutger Smit
Guest
Posts: n/a
 
      09-04-2004
Rutger Smit wrote:

> Amith Singh wrote:
>
>
> Run a cli9ent sided time somwhere somehow and when I reaches the 20
> minutes (default session timeout setting) you do something like a popup,
> redirect, etc.
>


Where was my mind?
Here the intended answer:


Run a clientsided script somewhere somehow and when it reaches the 20
minutes (default session timeout setting) you do something like a popup,
redirect, etc.

--

//Rutger

(E-Mail Removed)
www.RutgerSmit.com
 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      09-04-2004
I tried doing something like this before. I added some client side code on
page load to redirect after 20 minutes or whatever. Problem was a user
could stay on the same page for more than 20 minutes and keep the session
alive by posting back to itself. But when the client side script hit 20
minutes from the initial page load... whoops... times up.

I would like to see a solution myself.

Greg

"Rutger Smit" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Rutger Smit wrote:
>
> > Amith Singh wrote:
> >
> >
> > Run a cli9ent sided time somwhere somehow and when I reaches the 20
> > minutes (default session timeout setting) you do something like a popup,
> > redirect, etc.
> >

>
> Where was my mind?
> Here the intended answer:
>
>
> Run a clientsided script somewhere somehow and when it reaches the 20
> minutes (default session timeout setting) you do something like a popup,
> redirect, etc.
>
> --
>
> //Rutger
>
> (E-Mail Removed)
> www.RutgerSmit.com



 
Reply With Quote
 
Rutger Smit
Guest
Posts: n/a
 
      09-04-2004
Greg Burns wrote:

> I tried doing something like this before. I added some client side code on
> page load to redirect after 20 minutes or whatever. Problem was a user
> could stay on the same page for more than 20 minutes and keep the session
> alive by posting back to itself. But when the client side script hit 20
> minutes from the initial page load... whoops... times up.
>
> I would like to see a solution myself.
>
> Greg
>
>>Where was my mind?
>>Here the intended answer:
>>
>>
>>Run a clientsided script somewhere somehow and when it reaches the 20
>>minutes (default session timeout setting) you do something like a popup,
>> redirect, etc.
>>
>>--
>>
>>//Rutger
>>
>>(E-Mail Removed)
>>www.RutgerSmit.com

>
>
>



Maybe you can make the script a little bit more intelligent.
On the client: do the time thing that redirects after 20 minutes.
Redirect the client to a special page that check wheter the session is
still alive or not. If it is, no broblem, redirect the client to the
HTTP_REFERER header value. If the session has expired, redir to login page.

--

//Rutger

(E-Mail Removed)
www.RutgerSmit.com
 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      09-05-2004
I would think if I redirected using HTTP_REFERER header value that it would
cause IsPostBack to False again, plus viewstate would not be retained. I
would be as if it was the first time visiting the page.

Here is some code I was playing with that I found while visiting the online
ticket ordering at sixflags.com.

function WarnUserTimeout()
{
alert('Your session has expired. You are being redirected to the park
selection page.')
window.location.href = "tickets_parkselect.asp";
}

<body OnLoad="window.setTimeout('WarnUserTimeout()',10*6 0*1000)">

What would be great is if there was someway to reset the timer on every post
back...

Greg

> Maybe you can make the script a little bit more intelligent.
> On the client: do the time thing that redirects after 20 minutes.
> Redirect the client to a special page that check wheter the session is
> still alive or not. If it is, no broblem, redirect the client to the
> HTTP_REFERER header value. If the session has expired, redir to login

page.
>
> --
>
> //Rutger
>
> (E-Mail Removed)
> www.RutgerSmit.com



 
Reply With Quote
 
Rutger Smit
Guest
Posts: n/a
 
      09-05-2004
Greg Burns wrote:
> I would think if I redirected using HTTP_REFERER header value that it would
> cause IsPostBack to False again, plus viewstate would not be retained. I
> would be as if it was the first time visiting the page.
>
> Here is some code I was playing with that I found while visiting the online
> ticket ordering at sixflags.com.
>
> function WarnUserTimeout()
> {
> alert('Your session has expired. You are being redirected to the park
> selection page.')
> window.location.href = "tickets_parkselect.asp";
> }
>
> <body OnLoad="window.setTimeout('WarnUserTimeout()',10*6 0*1000)">
>
> What would be great is if there was someway to reset the timer on every post
> back...
>
> Greg
>
>
>




'reset the timer on every post back'
It does since it's JavaScript and thus running client sided.
If you're using frames you have to do some cross frame scripting with a
function that sets the timer to zero.

--

//Rutger

(E-Mail Removed)
www.RutgerSmit.com
 
Reply With Quote
 
Greg Burns
Guest
Posts: n/a
 
      09-06-2004
You know, you're right.

I just retested it to make sure I wasn't making this up, but couldn't
duplicate it. I definately had a problem with this very issue when I first
attempted this. I will need to take a second look.

Thanks,
Greg

> 'reset the timer on every post back'
> It does since it's JavaScript and thus running client sided.
> If you're using frames you have to do some cross frame scripting with a
> function that sets the timer to zero.
>
> --
>
> //Rutger
>
> (E-Mail Removed)
> www.RutgerSmit.com



 
Reply With Quote
 
 
 
Reply

Thread Tools

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Session variable values are lost when navigate from one page to an =?Utf-8?B?U00=?= ASP .Net 0 02-27-2007 11:26 PM
Session variable values are lost when navigate from one page to ot =?Utf-8?B?U00=?= ASP .Net 0 02-27-2007 02:06 AM
persisting login not working when session times out Rotsey ASP .Net 0 01-15-2007 06:15 AM
Session/Login still times out at 20 minutes even after changing defaults Andy Green ASP .Net 3 01-10-2004 03:25 PM
PROBLEMS : session timing out / login multiple times VSK ASP .Net Web Services 3 10-02-2003 09:53 AM



Advertisments