Cookie set, but not passing to the next page.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • JimJazz
    New Member
    • Feb 2010
    • 2

    #1

    Cookie set, but not passing to the next page.

    I'm setting a cookie to store a username for an extended period of time.

    Code:
    'If the user requested to be remembered...
    If memory = 1 Then
    Response.Cookies("Username") = rsLogin.Fields.Item("Username").Value
    Response.Cookies("Username").Expires= Date() + 7
    Session.Contents.Remove("Username")
    Else
    
    'If the user did not request to be remembered...
    Session("Username") = rsLogin.Fields.Item("Username").Value
    Response.Cookies("Username") = ""
    
    End If
    Due to the problem, I test it like this...

    Code:
    Response.Write("cookie -> " & Request.Cookies("Username") & "<br><br>")
    Response.Write("<a href=""test.asp"">test.asp</a>")
    Which gives me the output

    cookie -> jimjazz

    test.asp

    Next, I click on the "test.asp" link. On the test.asp page, I run the same test code..

    Code:
    Response.Write("cookie -> " & Request.Cookies("Username") & "<br><br>")
    And it gives the output:

    cookie ->

    What gives?

    (these are results for IE8, everything seems to work fine in FF3.5, but 98% of all my users are IE)
  • JimJazz
    New Member
    • Feb 2010
    • 2

    #2
    Oh... and I've set my IE permissions to "override automatic cookie handling" and accept everything. No dice.

    Why can't everyone just use firefox and make me happy?

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      hey Jim, try this:
      Code:
      <%
      dim x,y
      for each x in Request.Cookies
        response.write("<p>")
        if Request.Cookies(x).HasKeys then
          for each y in Request.Cookies(x)
            response.write(x & ":" & y & "=" & Request.Cookies(x)(y))
            response.write("<br />")
          next
        else
          Response.Write(x & "=" & Request.Cookies(x) & "<br />")
        end if
        response.write "</p>"
      next
      %>
      What does this give you?

      Jared

      Comment

      Working...