Redirecting to a page after login

Discussion in 'ASP General' started by Katie, Aug 4, 2006.

  1. Katie

    Katie Guest

    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
    :)
     
    Katie, Aug 4, 2006
    #1
    1. Advertising

  2. Katie

    Steven Burn Guest

    <%
    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" <> wrote in message
    news:...
    > 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
    > :)
    >
     
    Steven Burn, Aug 4, 2006
    #2
    1. Advertising

  3. Katie

    Evertjan. Guest

    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)
     
    Evertjan., Aug 4, 2006
    #3
  4. 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" <> wrote in message
    news:...
    > 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
    > :)
    >
     
    Kyle Peterson, Aug 4, 2006
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vijay
    Replies:
    3
    Views:
    1,483
    Saravana [MVP]
    Nov 4, 2003
  2. Pascal Blanchard
    Replies:
    0
    Views:
    248
    Pascal Blanchard
    Aug 17, 2004
  3. Pascal Blanchard
    Replies:
    1
    Views:
    280
    Pascal Blanchard
    Aug 18, 2004
  4. WhiskyRomeo

    redirecting from another page besides the login page

    WhiskyRomeo, Jan 18, 2005, in forum: ASP .Net Security
    Replies:
    1
    Views:
    117
    WhiskyRomeo
    Jan 18, 2005
  5. Replies:
    1
    Views:
    138
    ccc31807
    Mar 24, 2008
Loading...

Share This Page