If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > redirecting urls

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-28-05, 00:09
devonnicious devonnicious is offline
Registered User
 
Join Date: Mar 2004
Posts: 18
redirecting urls

lets say the user has clicked on the edit personal profile page, but hes not being logged in, thus he will be redirected back to the login page.

and after the user has logged in, i need to redirect the user back to the ORIGINAL page which the user wanna view, in this case it'll be the edit personal profile page.

may i know how do i go about doing the redirecting user back to the original page?

many thanks in advance. =)
Reply With Quote
  #2 (permalink)  
Old 01-28-05, 02:36
DrewM DrewM is offline
Registered User
 
Join Date: Jan 2005
Posts: 36
You could do something like this.

When the user hits the restricted page and gets bumped back to the login page, you probably are checking a session variable, something like this

if session("loggedin") <> 1 then response.redirect "login.htm"

You could add to it

if session("loggedin") <> 1 then
session("attemptedpage") = "editprofile.asp" //you would change this for different pages
response.redirect "login.htm"
end if

then in your login check pages, check for that session variable

// logged in successful
session("loggedin") = 1
if session("attemptedpage") <> "" then
response.redirect session("attemptedpage")
else
response.redirect "usualloginpage.asp"
end if

Last edited by DrewM; 01-28-05 at 02:39.
Reply With Quote
  #3 (permalink)  
Old 01-28-05, 21:41
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
The following code will redirect the user to the page she/he comes from.

Response.Redirect "../login/login.asp?redir=" & Server.URLEncode(Request.ServerVariables("PATH_INF O"))
Reply With Quote
  #4 (permalink)  
Old 01-28-05, 23:27
DrewM DrewM is offline
Registered User
 
Join Date: Jan 2005
Posts: 36
thats not what he asked - won't work for what he wants to do.
Reply With Quote
  #5 (permalink)  
Old 01-31-05, 22:27
gyuan gyuan is offline
Registered User
 
Join Date: Dec 2003
Posts: 454
Quote:
Originally Posted by devonnicious
lets say the user has clicked on the edit personal profile page, but hes not being logged in, thus he will be redirected back to the login page.

and after the user has logged in, i need to redirect the user back to the ORIGINAL page which the user wanna view, in this case it'll be the edit personal profile page.

may i know how do i go about doing the redirecting user back to the original page?

many thanks in advance. =)
First, you need to check if the user is logged in. If not, you can redirect the user to Login page. Here is the example. In your EditProfile.asp page, you can add the following code at the beginning of the code:

<%
If Session("UserID") = "" Then
Response.Redirect "../login/login.asp?redir=" & Server.URLEncode(Request.ServerVariables("PATH_INF O"))
End If
%>

In your Login.asp, you can catch the value of redir and then pass it to LoginProcess.asp page.
<form action="LoginProcess.asp" method="post">
<input type="hidden" name="redir" value="<%= Request("redir") %>">
......
</form>

In your LoginProcess.asp, you need to redirect the user to EditProfile.asp page if login is successful.

If Request("redir") <> "" Then
Response.Redirect Request("redir")
Else
' go to the page you want
End If
%>
Reply With Quote
  #6 (permalink)  
Old 02-02-05, 02:18
devonnicious devonnicious is offline
Registered User
 
Join Date: Mar 2004
Posts: 18
yup yup. everything's working now. thanks alot dudes !

and by the way, im not a HE. im a SHE. *winks* heh
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On