Problem with response.Cookie

Discussion in 'ASP General' started by kbrad, Oct 2, 2004.

  1. kbrad

    kbrad Guest

    I am trying to add some basic security to my asp web pages.
    I have a logon screen which, when the logon and password are checked for
    validity, passes the user on to a registration screen using the code
    response.Redirect "user_reg.asp?User=" & Request.Form("UserName")

    I then inserted the following line before the redirect
    response.Cookies("ValidUser") = "ValidUser"

    I have the following check at the start of the user_reg.asp page
    <%
    if request.Cookies("ValidUser") <> "VaildUser" then
    response.redirect "user_login.asp"
    End if
    %>

    All that happens now is that when I log in validly user_login.asp is
    redisplayed rather than the user_reg.asp.

    Perhaps this is not sufficient to set the cookie? I have looked for it but
    can't see it amoungst other cookies dated today.

    Can anyone advise?
     
    kbrad, Oct 2, 2004
    #1
    1. Advertising

  2. kbrad

    Evertjan. Guest

    =?Utf-8?B?a2JyYWQ=?= wrote on 02 okt 2004 in
    microsoft.public.inetserver.asp.general:

    > I am trying to add some basic security to my asp web pages.
    > I have a logon screen which, when the logon and password are checked
    > for validity, passes the user on to a registration screen using the
    > code response.Redirect "user_reg.asp?User=" & Request.Form("UserName")
    >
    > I then inserted the following line before the redirect
    > response.Cookies("ValidUser") = "ValidUser"
    >
    > I have the following check at the start of the user_reg.asp page
    > <%
    > if request.Cookies("ValidUser") <> "VaildUser" then
    > response.redirect "user_login.asp"
    > End if
    > %>
    >
    > All that happens now is that when I log in validly user_login.asp is
    > redisplayed rather than the user_reg.asp.
    >
    > Perhaps this is not sufficient to set the cookie? I have looked for it
    > but can't see it amoungst other cookies dated today.
    >
    > Can anyone advise?
    >


    "VaildUser" <> "ValidUser" but failed user

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

    Use session variables.

    if session("ValidUser") <> "ValidUser" then
    response.redirect "user_login.asp"
    End if


    And in user_login.asp:

    ..........
    if ok then
    session("ValidUser") = "ValidUser"
    end if


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress,
    but let us keep the discussions in the newsgroup)
     
    Evertjan., Oct 2, 2004
    #2
    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. Ben
    Replies:
    3
    Views:
    5,931
    Steven Cheng[MSFT]
    Jun 3, 2004
  2. =?Utf-8?B?RWFybCBUZWlncm9i?=

    Changing Response.Cookie from Instance to Shared (Static) Problem

    =?Utf-8?B?RWFybCBUZWlncm9i?=, Jul 29, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    506
    Marina
    Jul 29, 2004
  3. ad
    Replies:
    2
    Views:
    7,668
    Kevin Spencer
    Jan 27, 2006
  4. Replies:
    0
    Views:
    185
  5. s_m_b

    using response.cookie - problem

    s_m_b, Dec 7, 2004, in forum: ASP General
    Replies:
    0
    Views:
    144
    s_m_b
    Dec 7, 2004
Loading...

Share This Page