Redirecting to a page after login

K

Katie

Hi,

I want to be able to send users links to pages in my website. But if
they arent logged in I want them to first be redirected to the login
page and after they login automatically be redirected to the page i
sent them in the link. How would i accomplish this.

Thanks for your time and help
:)
 
S

Steven Burn

<%
Dim sTemp: sTemp = Request.ServerVariables("PATH_INFO")
Response.Redirect "/login.asp?ret=" & sTemp
%>

Or

<%
Dim sTemp: sTemp = Request.ServerVariables("URL")
Response.Redirect "/login.asp?ret=" & sTemp
%>

Or

<%
Dim sTemp: sTemp = Request.ServerVariables("SCRIPT_NAME")
Response.Redirect "/login.asp?ret=" & sTemp
%>

.... and if there's a querystring to go with it;

<%
Dim sTemp: sTemp = Request.ServerVariables("PATH_INFO")
Dim sQuery: sQuery = Request.ServerVariables("QUERY_STRING")
Response.Redirect "/login.asp?ret=" & sTemp & "?" & sQuery
%>

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
E

Evertjan.

Katie wrote on 04 aug 2006 in microsoft.public.inetserver.asp.general:
Hi,

I want to be able to send users links to pages in my website. But if
they arent logged in I want them to first be redirected to the login
page and after they login automatically be redirected to the page i
sent them in the link. How would i accomplish this.

Thanks for your time and help
:)

<%
session("thisPage") = Request.ServerVariables("SCRIPT_NAME")
if session("loggedIn") = "" then response.redirect "\login.asp"
%>
<html>
............

=======================

\login.asp

<%


........
if .....
session("loggedIn") = "Yes !"
response.redirect session("thisPage")
...........


%>
 
K

Kyle Peterson

try the free version of www.aspprotect.com
it might give you some ideas other than your redirection scenario which in
my opinion is not the best way to do things

redirection is seldom necessary and usually not the best way to design
things... in your case I think it makes more sense to have every page become
a login page on its own if the person is not logged in.. then take them
right to that same page after login is completed.. why bother redirecting
them somewhere ??

search www.aspin.com as well for many good login scripts
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top