| Author |
Topic Search Topic Options
|
cuedog
Groupie
Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
|
Post Options
Thanks(0)
Quote Reply
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?
|
|
|
 |
God_Struth
Senior Member
Joined: 07 August 2003
Location: United Kingdom
Status: Offline
Points: 218
|
Post Options
Thanks(0)
Quote Reply
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......"
|
 |
cuedog
Groupie
Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
|
Post Options
Thanks(0)
Quote Reply
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?
|
|
|
 |
KCWebMonkey
Senior Member
Go Chiefs!
Joined: 21 June 2002
Status: Offline
Points: 1319
|
Post Options
Thanks(0)
Quote Reply
Posted: 11 October 2003 at 11:34pm |
|
you can find the URL of the refering page by using Request.ServerVariables("HTTP_REFERER")
|
 |
vshriniwasan
Groupie
Joined: 17 December 2001
Location: United States
Status: Offline
Points: 63
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
KCWebMonkey
Senior Member
Go Chiefs!
Joined: 21 June 2002
Status: Offline
Points: 1319
|
Post Options
Thanks(0)
Quote Reply
Posted: 13 October 2003 at 5:20pm |
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...
|
 |
cuedog
Groupie
Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
|
Post Options
Thanks(0)
Quote Reply
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
%>
|
|
|
 |
cuedog
Groupie
Joined: 29 December 2001
Location: United States
Status: Offline
Points: 138
|
Post Options
Thanks(0)
Quote Reply
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
%>
|
|
|
 |