Cookie Expires works in one instance, not another

Discussion in 'ASP General' started by Alex Kail, Jul 13, 2004.

  1. Alex Kail

    Alex Kail Guest

    I have a site that you can only gain access to if you are logged in.
    My sign in screen asks for your email address and password. If all
    checks out, I write out information to a cookie (Cookie 1).

    Some people on the site, myself included, are moderators of the site.
    Moderator functionality is all over the site, so I created a toggle
    button that will make the site pages look like everyone elses, with
    the exception of this toggle button. The toggle uses a cookie,
    basically the same code except the data being placed in the cookie is
    different. (Cookie 2)

    Cookie 1 code:
    Response.Cookies("Member")("ID") =
    CStr(rsLogin.Fields("Member_ID").Value)
    Response.Cookies("Member").Expires = DateAdd("d", 365, Date)

    Cookie 2 code:
    Response.Cookies("Moderator")("Mode") = "ON"
    Response.Cookies("Moderator").Expires = DateAdd("d", 365, Date)

    As you can see, not much difference between the two, but the second
    works fine. I have tried placing the Expires code ABOVE and BELOW, but
    that doesn't work.

    Any suggestions, please?
    Alex Kail, Jul 13, 2004
    #1
    1. Advertising

  2. Alex Kail

    Alex Kail Guest

    It might have helped if I finished my post. The first cookie is acting
    like a cokkie with no expiration date set (ie - it is lost when the
    browser session is closed). I can get logged in OK, obviously, but
    want the cookie to be preserved after the browser is closed.

    Help, anyone.

    Alex Kail
    Alex Kail, Jul 14, 2004
    #2
    1. Advertising

  3. Alex Kail

    Alex Kail Guest

    Never mind, I found the problem.
    Alex Kail, Jul 14, 2004
    #3
    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. Replies:
    1
    Views:
    572
    clintonG
    Dec 30, 2005
  2. Amir Tohidi
    Replies:
    0
    Views:
    1,176
    Amir Tohidi
    Dec 18, 2007
  3. Joe

    Setting Cookie.Expires

    Joe, Mar 6, 2008, in forum: ASP .Net
    Replies:
    4
    Views:
    477
    Steven Cheng
    Mar 11, 2008
  4. Pete
    Replies:
    0
    Views:
    145
  5. time is life
    Replies:
    3
    Views:
    333
    Dominick Baier
    Apr 2, 2008
Loading...

Share This Page