Re: Logged in - Session timeout

From: Rob Meade (robb.meade_at_NO-SPAM.kingswoodweb.net)
Date: 06/06/04


Date: Sun, 06 Jun 2004 12:18:42 GMT


"Targa" wrote ...

> How can I return them to the page they were on when the session timed out,
> rather than starting over on the homepage?

Hi Targa,

We wrote something at work that would do this for exactly the same purpose -
dont have the code to hand, but basically you need to send a URL to your
login page - which then redirects the user to that URL...you need to also
take any querystring info with it that you may need....

ie..

Page you're on before time out occurs:

http://www.your-domain.com/surprise.asp?kbid=1234

Now the users times out and you redirect them to your login page, at this
point we created the URL and querystring and put it into a new querystring
value for the redirect, ie...

http://www.your-domain.com/login.asp?url=http://www.your-domain.com/surprise.asp?kbid1234

within your login code you'd need to check to see if URL in the querystring
existed, if it does, takes its value and use that as the redirect instead of
going to your home page.

Somethings we found were that you'll need to URL encode the URL you are
going to redirect to BEFORE you add it to the querystring returning to the
login page, this was because it will other wise take only the first part of
the querystring, and not anything which you may have after &'s etc...

ie..

http://www.your-domain.com/surprise.asp?kbid=1234&sid=5678

when it reads that it'll only use the first part,

ie.

http://www.your-domain.com/surprise.asp?kbid=1234

and assume that the &sid=5678 belonged to the login page (ie, it gets lost)

Use Server.URLEncode before adding the URL to the login pages redirect and
you'll be fine.

Incidentally, we built the URL and querystring from stratch to a new
variable as some of our websites use SSL (ie, https) and others dont (http)
so we wanted to ensure that we always took them to the correct place.

I trust this is of some use...

Regards

Rob



Relevant Pages

  • Re: Logged in - Session timeout
    ... You have that info in a session, and then simply send them to: ... take any querystring info with it that you may need.... ... Now the users times out and you redirect them to your login page, ...
    (microsoft.public.inetserver.asp.general)
  • RE: request page I cant have -> goes to login
    ... logged in also - and in that case I do want them on the login page. ... "ReturnUrl" querystring, so that it can redirect the user back to the ... This posting is provided "AS IS" with no warranties, and confers no rights. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: VBscript response redirection
    ... redirect to orginal page? ... > forget about the querystring and just use http_referer, ... >> on the login page ... >> the following extra characters got appended at the end of the URL ...
    (microsoft.public.inetserver.asp.general)
  • Re: Default.aspx - newbie Q`
    ... check and redirect to the ReturnURL or Selected.aspx depending on the case. ... > and replace it with something that takes then straight to the login page. ... >> Curt Christianson ... >>> authentication ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Default.aspx - newbie Q`
    ... check and redirect to the ReturnURL or Selected.aspx depending on the case. ... > and replace it with something that takes then straight to the login page. ... >> Curt Christianson ... >>> authentication ...
    (microsoft.public.dotnet.framework.aspnet)

Loading