Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to check automatically for "end of session" and force a page redirection?

Reply
Thread Tools

How to check automatically for "end of session" and force a page redirection?

 
 
Athenian
Guest
Posts: n/a
 
      07-13-2006
Hi guys.

Currently I need a javascript (client side) or vbscript(server side)
code to check automatically for session expiration and force the
redirection to a message page or the log-in page. All web site is built
around asp pages.

Thank you very much for your help

 
Reply With Quote
 
 
 
 
RobG
Guest
Posts: n/a
 
      07-13-2006

Athenian wrote:
> Hi guys.
>
> Currently I need a javascript (client side) or vbscript(server side)
> code to check automatically for session expiration and force the
> redirection to a message page or the log-in page. All web site is built
> around asp pages.


Use either setTimeout or setInterval to send an intermittent
XMLHttpRequest from the client to check with the server to see if the
session is still active at say 1 minute intervals. If the session has
timed-out, redirect.

It may be unreliable.


--
Rob

 
Reply With Quote
 
 
 
 
Jeremy
Guest
Posts: n/a
 
      07-14-2006
Athenian wrote:
> Hi guys.
>
> Currently I need a javascript (client side) or vbscript(server side)
> code to check automatically for session expiration and force the
> redirection to a message page or the log-in page. All web site is built
> around asp pages.
>
> Thank you very much for your help
>


Please clarify: do you want them to be taken to a log-in page
immediately when their session expires, or the next time they request a
page and their session has expired?

If it's the former (which is a bad idea - what if they are working on
something when their session expires? They are whisked away to a login
page whether they like it or not? Some action on their end - i.e.
requesting a page - should happen before you do this) then RobG's
suggestion is what you're looking for.

If it's the latter, you should ask in an ASP group. But it will go
something like this (note, this is C# code as I don't use VBScript):

if(Session["key_to_check"] == null)
Response.Redirect("/myloginpage.asp");

If you have authorization code already, I would be surprised if this
code isn't already included. If the user's session is no longer valid,
and they are still able to access protected pages, your site is a
desperately insecure.

Jeremy
 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
Nike Air Force Ones,Air Force One Air Force One-1 lky52193@gmail.com Computer Support 0 01-17-2008 04:40 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:46 PM
Nike Air Force Ones,Air Force One Air Force One-1,25th anniversary lky52112@gmail.com Digital Photography 0 01-15-2008 04:34 PM



Advertisments