469,915 Members | 2,697 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,915 developers. It's quick & easy.

redirect to correct page

I have a few pages that require login to access. Assuming a user clicks a
link containing a variable trying to access a password protected page. That
user is redirected to the login page. After login, he's brought to a "logged
in" page. How do I retain the original link he clicked and instead of
redirecting to a logged in page, he's redirected to the page he originally
requested?

(hope that makes sense...)
thanks
Jul 19 '05 #1
1 1610
In the include that checks if the user is logged in:

If Session("loggedin") = "" Then
Response.Redirect "login.asp?r=" &
Server.URLEncode(Request.ServerVariables("URL") & Request.Querystring)
End If
login.asp:

<input type="hidden" name="redirect" value="<%=Request.Querystring("r")%>">

On the page that validates login:

sRedirect = Request.Form("redirect")
If sRedirect = "" Then sRedirect = "yourdefaultpage.asp"
Untested

Ray at work
"shank" <sh***@tampabay.rr.com> wrote in message
news:uG**************@TK2MSFTNGP09.phx.gbl...
I have a few pages that require login to access. Assuming a user clicks a
link containing a variable trying to access a password protected page. That user is redirected to the login page. After login, he's brought to a "logged in" page. How do I retain the original link he clicked and instead of
redirecting to a logged in page, he's redirected to the page he originally
requested?

(hope that makes sense...)
thanks

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Bob Garbados | last post: by
3 posts views Thread by Sean Berry | last post: by
1 post views Thread by Andy Todd | last post: by
13 posts views Thread by Tim | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.