Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Session Times Out.... Navigate to Login Page (http://www.velocityreviews.com/forums/t86087-session-times-out-navigate-to-login-page.html)

Amith Singh 09-04-2004 06:14 PM

Session Times Out.... Navigate to Login Page
 
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



Scott Allen 09-04-2004 07:32 PM

Re: Session Times Out.... Navigate to Login Page
 
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"
<AmithSin@hotmail.com> 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
>



Rutger Smit 09-04-2004 07:55 PM

Re: Session Times Out.... Navigate to Login Page
 
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

DoDotNet@Gmail.com
www.RutgerSmit.com

Rutger Smit 09-04-2004 08:00 PM

Re: Session Times Out.... Navigate to Login Page
 
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

DoDotNet@Gmail.com
www.RutgerSmit.com

Greg Burns 09-04-2004 08:24 PM

Re: Session Times Out.... Navigate to Login Page
 
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" <DoDotNet@gmail.com> wrote in message
news:10jk7k75fscpdbb@corp.supernews.com...
> 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
>
> DoDotNet@Gmail.com
> www.RutgerSmit.com




Rutger Smit 09-04-2004 09:41 PM

Re: Session Times Out.... Navigate to Login Page
 
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
>>
>>DoDotNet@Gmail.com
>>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

DoDotNet@Gmail.com
www.RutgerSmit.com

Greg Burns 09-05-2004 12:11 PM

Re: Session Times Out.... Navigate to Login Page
 
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
>
> DoDotNet@Gmail.com
> www.RutgerSmit.com




Rutger Smit 09-05-2004 11:29 PM

Re: Session Times Out.... Navigate to Login Page
 
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

DoDotNet@Gmail.com
www.RutgerSmit.com

Greg Burns 09-06-2004 12:29 AM

Re: Session Times Out.... Navigate to Login Page
 
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
>
> DoDotNet@Gmail.com
> www.RutgerSmit.com





All times are GMT. The time now is 05:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.