best way to redirect asp to login htm page?

Ask a Question related to ASP, Design and Development.

  1. #1

    Default best way to redirect asp to login htm page?

    Hello,

    I need users to access a data entry asp page via a login
    page. If they bookmark the data entry asp I want to
    redirect them to the login page (using IIS). Here is what
    I had in mind:

    <%@ LANGUAGE=JScript %>
    <HTML>
    <HEAD>
    <TITLE>Home Page</TITLE>
    <script language="JavaScript">
    function myFunction(s){
    ....
    location.href='insert.htm';}
    </SCRIPT>
    </HEAD>
    <body onLoad="myFunction('<%Response.write(Request.Form
    ("testfld"));%>')">
    ....

    Isn't there some kind of authentication method for IIS, or
    at least a less kludgy way of doing this than what I have
    above? Just checking.

    Thanks,
    Rich
    Rich Guest

  2. Similar Questions and Discussions

    1. Login Redirect
      Hi, all I have this login script that calls on itself to authenticate the username and the password. It redisplays the login page if there is an...
    2. Login redirect back to previous page
      I have a number of secured pages and a login process that works. When a user tries to access a secure page prior to logging in, he is redirected to...
    3. Forms Authentication won't redirect to login page
      I'm trying to set basic form authentication on a webapp. I allaccess restricted to authenticated users. After changing theWeb.config file in the...
    4. login redirect doesn't work
      Hello, I'm working on a asp.net/C# project, but I haven't got a lot of experience with programming with C# and the dotnet framework. I've build...
    5. Login User and Redirect to a specific page - help required
      I'm using ASP/Access 2000. This is what I would like to do. A site has a limited number of users - User Bert logs in and assuming gets thru...
  3. #2

    Default Re: best way to redirect asp to login htm page?

    have the login place a cookie/session variable...check for it...if it's not
    there redirect

    --
    ----------------------------------------------------------
    Curt Christianson (Software_AT_Darkfalz.Com)
    Owner/Lead Designer, DF-Software
    [url]http://www.Darkfalz.com[/url]
    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------


    "Rich" <rpng123@aol.com> wrote in message
    news:4e8f01c3765f$6887b240$a401280a@phx.gbl...
    > Hello,
    >
    > I need users to access a data entry asp page via a login
    > page. If they bookmark the data entry asp I want to
    > redirect them to the login page (using IIS). Here is what
    > I had in mind:
    >
    > <%@ LANGUAGE=JScript %>
    > <HTML>
    > <HEAD>
    > <TITLE>Home Page</TITLE>
    > <script language="JavaScript">
    > function myFunction(s){
    > ...
    > location.href='insert.htm';}
    > </SCRIPT>
    > </HEAD>
    > <body onLoad="myFunction('<%Response.write(Request.Form
    > ("testfld"));%>')">
    > ...
    >
    > Isn't there some kind of authentication method for IIS, or
    > at least a less kludgy way of doing this than what I have
    > above? Just checking.
    >
    > Thanks,
    > Rich

    Curt_C [MVP] Guest

  4. #3

    Default Re: best way to redirect asp to login htm page?

    Thank you for your reply. This sounds logical. May I
    request one more thing? I took a course in javascript
    which used some asp examples a few years ago (didn't work
    with it since then). Now I am back at it for real. We
    did infact work with cookies, but I only vaguely remember
    how to set/read them. Would have any sample syntax or
    point me where I could see some examples? JS/vbs either
    or.

    Thanks again for your reply.

    Rich

    >-----Original Message-----
    >have the login place a cookie/session variable...check
    for it...if it's not
    >there redirect
    >
    >--
    >----------------------------------------------------------
    >Curt Christianson (Software_AT_Darkfalz.Com)
    >Owner/Lead Designer, DF-Software
    >[url]http://www.Darkfalz.com[/url]
    >---------------------------------------------------------
    >...Offering free scripts & code snippits for everyone...
    >---------------------------------------------------------
    >
    >
    >"Rich" <rpng123@aol.com> wrote in message
    >news:4e8f01c3765f$6887b240$a401280a@phx.gbl...
    >> Hello,
    >>
    >> I need users to access a data entry asp page via a login
    >> page. If they bookmark the data entry asp I want to
    >> redirect them to the login page (using IIS). Here is
    what
    >> I had in mind:
    >>
    >> <%@ LANGUAGE=JScript %>
    >> <HTML>
    >> <HEAD>
    >> <TITLE>Home Page</TITLE>
    >> <script language="JavaScript">
    >> function myFunction(s){
    >> ...
    >> location.href='insert.htm';}
    >> </SCRIPT>
    >> </HEAD>
    >> <body onLoad="myFunction('<%Response.write(Request.Form
    >> ("testfld"));%>')">
    >> ...
    >>
    >> Isn't there some kind of authentication method for IIS,
    or
    >> at least a less kludgy way of doing this than what I
    have
    >> above? Just checking.
    >>
    >> Thanks,
    >> Rich
    >
    >
    >.
    >
    Rich Guest

  5. #4

    Default Re: best way to redirect asp to login htm page?

    VBScript

    string = Request.Cookies("name")
    Response.Cookies("name") = string


    --
    ----------------------------------------------------------
    Curt Christianson (Software_AT_Darkfalz.Com)
    Owner/Lead Designer, DF-Software
    [url]http://www.Darkfalz.com[/url]
    ---------------------------------------------------------
    ...Offering free scripts & code snippits for everyone...
    ---------------------------------------------------------


    "Rich" <rpng123@aol.com> wrote in message
    news:4f6801c37671$67141fe0$a601280a@phx.gbl...
    > Thank you for your reply. This sounds logical. May I
    > request one more thing? I took a course in javascript
    > which used some asp examples a few years ago (didn't work
    > with it since then). Now I am back at it for real. We
    > did infact work with cookies, but I only vaguely remember
    > how to set/read them. Would have any sample syntax or
    > point me where I could see some examples? JS/vbs either
    > or.
    >
    > Thanks again for your reply.
    >
    > Rich
    >
    >
    > >-----Original Message-----
    > >have the login place a cookie/session variable...check
    > for it...if it's not
    > >there redirect
    > >
    > >--
    > >----------------------------------------------------------
    > >Curt Christianson (Software_AT_Darkfalz.Com)
    > >Owner/Lead Designer, DF-Software
    > >[url]http://www.Darkfalz.com[/url]
    > >---------------------------------------------------------
    > >...Offering free scripts & code snippits for everyone...
    > >---------------------------------------------------------
    > >
    > >
    > >"Rich" <rpng123@aol.com> wrote in message
    > >news:4e8f01c3765f$6887b240$a401280a@phx.gbl...
    > >> Hello,
    > >>
    > >> I need users to access a data entry asp page via a login
    > >> page. If they bookmark the data entry asp I want to
    > >> redirect them to the login page (using IIS). Here is
    > what
    > >> I had in mind:
    > >>
    > >> <%@ LANGUAGE=JScript %>
    > >> <HTML>
    > >> <HEAD>
    > >> <TITLE>Home Page</TITLE>
    > >> <script language="JavaScript">
    > >> function myFunction(s){
    > >> ...
    > >> location.href='insert.htm';}
    > >> </SCRIPT>
    > >> </HEAD>
    > >> <body onLoad="myFunction('<%Response.write(Request.Form
    > >> ("testfld"));%>')">
    > >> ...
    > >>
    > >> Isn't there some kind of authentication method for IIS,
    > or
    > >> at least a less kludgy way of doing this than what I
    > have
    > >> above? Just checking.
    > >>
    > >> Thanks,
    > >> Rich
    > >
    > >
    > >.
    > >

    Curt_C [MVP] Guest

  6. #5

    Default Re: best way to redirect asp to login htm page?

    Hey rich, does your login page submit straight to the data entry page?

    If so then at the start of the data entry page you could just check that one
    of the fields from your login page actually has data in it, and if it
    doesn't then redirect the user back there.

    so put this at thge start of your data entry page..

    <%
    if request.form("yourformfield")="" then

    response.write "<script>alert('you must come here from the login
    page.')</script>";
    response.redirect "login.htm"

    else
    'show the data entry page


    end if

    %>

    hoope this helps

    dave



    "Rich" <rpng123@aol.com> wrote in message
    news:4e8f01c3765f$6887b240$a401280a@phx.gbl...
    > Hello,
    >
    > I need users to access a data entry asp page via a login
    > page. If they bookmark the data entry asp I want to
    > redirect them to the login page (using IIS). Here is what
    > I had in mind:
    >
    > <%@ LANGUAGE=JScript %>
    > <HTML>
    > <HEAD>
    > <TITLE>Home Page</TITLE>
    > <script language="JavaScript">
    > function myFunction(s){
    > ...
    > location.href='insert.htm';}
    > </SCRIPT>
    > </HEAD>
    > <body onLoad="myFunction('<%Response.write(Request.Form
    > ("testfld"));%>')">
    > ...
    >
    > Isn't there some kind of authentication method for IIS, or
    > at least a less kludgy way of doing this than what I have
    > above? Just checking.
    >
    > Thanks,
    > Rich

    Dave Mitchell Guest

  7. #6

    Default best way to redirect asp to login htm page?

    Thank you all for your responses. This really helps me
    out. I actually know how to do this stuff in JSP, but I
    don't want to use Tomcat because I am all hooked up with
    IIS/SqlServer now. My vbscripting is weak, at best. Oh
    well. I will be hanging around here a lot :).

    Thanks again,
    Rich
    >-----Original Message-----
    >Hello,
    >
    >I need users to access a data entry asp page via a login
    >page. If they bookmark the data entry asp I want to
    >redirect them to the login page (using IIS). Here is
    what
    >I had in mind:
    >
    ><%@ LANGUAGE=JScript %>
    ><HTML>
    ><HEAD>
    ><TITLE>Home Page</TITLE>
    ><script language="JavaScript">
    >function myFunction(s){
    >....
    > location.href='insert.htm';}
    ></SCRIPT>
    ></HEAD>
    ><body onLoad="myFunction('<%Response.write(Request.Form
    >("testfld"));%>')">
    >....
    >
    >Isn't there some kind of authentication method for IIS,
    or
    >at least a less kludgy way of doing this than what I have
    >above? Just checking.
    >
    >Thanks,
    >Rich
    >.
    >
    Rich Guest

  8. #7

    Default Re: best way to redirect asp to login htm page?

    Rich, how about this? A friend of mine found this (or invented it).
    Put it in your global.asa file in the Session_OnStart routine.

    ' If someone initially tries to load any page other than the
    ' start page, redirect them.
    ' NOTE - If the redirect happens, the rest of this function
    ' is not executed, so be sure this is LAST!

    Session("requestedPage") = Request.ServerVariables("SCRIPT_NAME")
    if not (STRCOMP(Application("StartPage"), Session("requestedPage"),
    vbTextCompare)=0) then
    Response.Redirect Application("StartPage")
    end if

    Works for me. No cookies (other than ASP's own). Just set
    Application("StartPage") to "login.asp" (or whatever you're using) in
    your Application_OnStart routine.

    Tom

    On Tue, 9 Sep 2003 07:52:56 -0700, "Rich" <rpng123@aol.com> wrote:
    >Thank you all for your responses. This really helps me
    >out. I actually know how to do this stuff in JSP, but I
    >don't want to use Tomcat because I am all hooked up with
    >IIS/SqlServer now. My vbscripting is weak, at best. Oh
    >well. I will be hanging around here a lot :).
    >
    >Thanks again,
    >Rich
    >
    >>-----Original Message-----
    >>Hello,
    >>
    >>I need users to access a data entry asp page via a login
    >>page. If they bookmark the data entry asp I want to
    >>redirect them to the login page (using IIS). Here is
    >what
    >>I had in mind:
    >>
    >><%@ LANGUAGE=JScript %>
    >><HTML>
    >><HEAD>
    >><TITLE>Home Page</TITLE>
    >><script language="JavaScript">
    >>function myFunction(s){
    >>....
    >> location.href='insert.htm';}
    >></SCRIPT>
    >></HEAD>
    >><body onLoad="myFunction('<%Response.write(Request.Form
    >>("testfld"));%>')">
    >>....
    >>
    >>Isn't there some kind of authentication method for IIS,
    >or
    >>at least a less kludgy way of doing this than what I have
    >>above? Just checking.
    >>
    >>Thanks,
    >>Rich
    >>.
    >>
    Tom Bates Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139