Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - login redirect
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

login redirect

 Post Reply Post Reply
Author
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post Topic: login redirect
    Posted: 11 October 2003 at 6:06pm
I want to know what I need to include in my login script to redirect the user back to the page they were trying to access.
For example, if a user wanted to access a directory with permission levels and they were not logged in they would be sent back to the login page and after they logged in they would be redirected back to the directory. I also want to make sure they are not redirected to an outside site if they had the directory bookmarked.
Can anyone help?
Back to Top
God_Struth View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 August 2003
Location: United Kingdom
Status: Offline
Points: 218
Post Options Post Options   Thanks (0) Thanks(0)   Quote God_Struth Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2003 at 6:45pm
Else If intForumID > 0 Then
                      Response.Redirect("forum_topics.asp?FID=" & intForumID)
                                              
'Return to forum homepage
                 Else
     Response.Redirect("default.asp ")
End If

-------------

Thats what I used from Login_user.asp
"I'm only trying to help......"
Back to Top
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2003 at 7:36pm
Thanks, but lets say someone has to login before they download an application and there is no intForumID then what do you do?
Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 11 October 2003 at 11:34pm
you can find the URL of the refering page by using Request.ServerVariables("HTTP_REFERER")
Back to Top
vshriniwasan View Drop Down
Groupie
Groupie
Avatar

Joined: 17 December 2001
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote vshriniwasan Quote  Post ReplyReply Direct Link To This Post Posted: 12 October 2003 at 8:10pm

I am not 100% sure, but the HTTP_REFERER only keeps your previous page in memory. When you login, well thats two tries is involved and your refere has changed. I would just suggest just pass two values, section you are clicking the like, like Download, and the ID number you are clicking, then after logging in, just redirect to that page. The same way you can do it to different sections, just doing, select case statement.

Shrini

Back to Top
KCWebMonkey View Drop Down
Senior Member
Senior Member
Avatar
Go Chiefs!

Joined: 21 June 2002
Status: Offline
Points: 1319
Post Options Post Options   Thanks (0) Thanks(0)   Quote KCWebMonkey Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2003 at 5:20pm
Originally posted by vshriniwasan vshriniwasan wrote:

I am not 100% sure, but the HTTP_REFERER only keeps your previous page in memory. When you login, well thats two tries is involved and your refere has changed.

that's why you store the page url in a variable and then pass it as a querystring to the next page...

Back to Top
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2003 at 10:14pm
Good ideas, one good way to do it would be to use the SCRIPT_NAME servervariable in the page that requires to be logged in and put it in a variable and pass it as a querystring back to the login page.

For Example:

<%
Dim strRefUrl
strRefUrl = Request.ServerVariables("SCRIPT_NAME")
If Request.Cookies("PollAdmin") = "" Then
Response.Redirect ("login.asp?ref=" & strRefUrl)
End If
%>
Back to Top
cuedog View Drop Down
Groupie
Groupie
Avatar

Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
Post Options Post Options   Thanks (0) Thanks(0)   Quote cuedog Quote  Post ReplyReply Direct Link To This Post Posted: 13 October 2003 at 10:22pm
I tried this out right after I posted this instead of before and it seems that HTTP_Referer will carry over the querystrings, but SCRIPT_NAME will not. So the code should be

<%
Dim strRefUrl
strRefUrl = Request.ServerVariables("HTTP_REFERER")
If Request.Cookies("PollAdmin") = "" Then
Response.Redirect ("login.asp?ref=" & strRefUrl)
End If
%>
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.