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
%>