473,406 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Redirecting to a page after login

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
:)

Aug 4 '06 #1
3 2355
<%
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!

"Katie" <Dn*********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
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
:)

Aug 4 '06 #2
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")
...........
%>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Aug 4 '06 #3
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

"Katie" <Dn*********@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
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
:)

Aug 4 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stu | last post by:
Hi All, I have an ASP.NET application to which I have implemented forms authentication to handle security. It is a relatively straight forward solution with all aspx pages residing in the root...
0
by: James Wallace | last post by:
Is it possible to use forms authentication in the web.config file and FormsAuthentication.RedirectFromLoginPage with an asp page so that when the asp page is set to startup page on the project that...
4
by: jjjooooohhnnn | last post by:
Greetings, I have encountered what appears to be a fairly common problem: RedirectFromLoginPage is not redirecting to RedirectUrl. I have tried all the advice that I could on the 'net, and...
1
by: Jeremy Chapman | last post by:
I have built a web app. While testing I have found that if I browse to a page in the app, then get redirected to the login page and enter my credentials. The...
2
by: Gary Coutts | last post by:
Hi, I am have problems redirecting from a login page. The login page is simple, with just 2 textboxes and one button. On the button click the routine below is called: I am using: Visual...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
9
by: Jonathan Wood | last post by:
I've spent days trying to come up with a solution. I'd appreciate it if anyone can help. My site requires all users to log on. There are three different roles of users, and each user type will...
0
by: Anup Daware | last post by:
Hi All, I am facing this very weird issue, for every server request my control is redirecting to the login page and again coming back to the actual page from where the request was initiated when I...
6
by: rpcchandu | last post by:
Hi Coders, I have to redirect from my server to the different server page by simulating the POST method submit from the Controller file, I tried using post_via_redirect, but could not succeed......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.