Issue with Cookies not getting deleted even after setting a previous date in expires property

Discussion in 'ASP General' started by techie, Sep 16, 2003.

  1. techie

    techie Guest

    I am using the following to delete the contents of a cookie

    Response.Cookies("maincookie").expires = DateAdd("d",-2,now)
    Response.redirect "login.asp"

    If i try to alert the value of the cookie in the same page, it shows
    the old value. As well as when it is alerted from the login.asp it
    shows the old value.
    The problem is when i try to update the value of the cookie in the
    login page, it does not update the new value.
    Only if i close the browser and reopen, the new value gets updated and
    even if the old value is originally present in the cookie.
    I am specifying the domain and path when creating the cookie. the
    expires property is set to date + 1 when creating.

    What should be done to delete the contents of the cookie? Should i
    specify the domain as well as path when changing the expires property?
    Thanks in advance
    techie, Sep 16, 2003
    #1
    1. Advertising

  2. techie

    Curt_C [MVP] Guest

    I suspect the page/site info is being cached. Try putting the "no cache"
    code into your page(s).

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


    "techie" <> wrote in message
    news:...
    > I am using the following to delete the contents of a cookie
    >
    > Response.Cookies("maincookie").expires = DateAdd("d",-2,now)
    > Response.redirect "login.asp"
    >
    > If i try to alert the value of the cookie in the same page, it shows
    > the old value. As well as when it is alerted from the login.asp it
    > shows the old value.
    > The problem is when i try to update the value of the cookie in the
    > login page, it does not update the new value.
    > Only if i close the browser and reopen, the new value gets updated and
    > even if the old value is originally present in the cookie.
    > I am specifying the domain and path when creating the cookie. the
    > expires property is set to date + 1 when creating.
    >
    > What should be done to delete the contents of the cookie? Should i
    > specify the domain as well as path when changing the expires property?
    > Thanks in advance
    Curt_C [MVP], Sep 16, 2003
    #2
    1. Advertising

  3. techie

    techie Guest

    Thanks for your response.
    I have the "no cache" code already in the files.
    The main problem is that as soon as i update the value of the cookie
    and alert it.. its shows updated value.. but in the following pages it
    still uses the old value unless i close the browser and re-open.



    "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message news:<>...
    > I suspect the page/site info is being cached. Try putting the "no cache"
    > code into your page(s).
    >
    > --
    > ----------------------------------------------------------
    > Curt Christianson (Software_AT_Darkfalz.Com)
    > Owner/Lead Designer, DF-Software
    > http://www.Darkfalz.com
    > ---------------------------------------------------------
    > ..Offering free scripts & code snippits for everyone...
    > ---------------------------------------------------------
    >
    >
    > "techie" <> wrote in message
    > news:...
    > > I am using the following to delete the contents of a cookie
    > >
    > > Response.Cookies("maincookie").expires = DateAdd("d",-2,now)
    > > Response.redirect "login.asp"
    > >
    > > If i try to alert the value of the cookie in the same page, it shows
    > > the old value. As well as when it is alerted from the login.asp it
    > > shows the old value.
    > > The problem is when i try to update the value of the cookie in the
    > > login page, it does not update the new value.
    > > Only if i close the browser and reopen, the new value gets updated and
    > > even if the old value is originally present in the cookie.
    > > I am specifying the domain and path when creating the cookie. the
    > > expires property is set to date + 1 when creating.
    > >
    > > What should be done to delete the contents of the cookie? Should i
    > > specify the domain as well as path when changing the expires property?
    > > Thanks in advance
    techie, Sep 17, 2003
    #3
  4. techie

    Curt_C [MVP] Guest

    where is the cookie "read" in? on the other page or ?

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


    "techie" <> wrote in message
    news:...
    > Thanks for your response.
    > I have the "no cache" code already in the files.
    > The main problem is that as soon as i update the value of the cookie
    > and alert it.. its shows updated value.. but in the following pages it
    > still uses the old value unless i close the browser and re-open.
    >
    >
    >
    > "Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message

    news:<>...
    > > I suspect the page/site info is being cached. Try putting the "no cache"
    > > code into your page(s).
    > >
    > > --
    > > ----------------------------------------------------------
    > > Curt Christianson (Software_AT_Darkfalz.Com)
    > > Owner/Lead Designer, DF-Software
    > > http://www.Darkfalz.com
    > > ---------------------------------------------------------
    > > ..Offering free scripts & code snippits for everyone...
    > > ---------------------------------------------------------
    > >
    > >
    > > "techie" <> wrote in message
    > > news:...
    > > > I am using the following to delete the contents of a cookie
    > > >
    > > > Response.Cookies("maincookie").expires = DateAdd("d",-2,now)
    > > > Response.redirect "login.asp"
    > > >
    > > > If i try to alert the value of the cookie in the same page, it shows
    > > > the old value. As well as when it is alerted from the login.asp it
    > > > shows the old value.
    > > > The problem is when i try to update the value of the cookie in the
    > > > login page, it does not update the new value.
    > > > Only if i close the browser and reopen, the new value gets updated and
    > > > even if the old value is originally present in the cookie.
    > > > I am specifying the domain and path when creating the cookie. the
    > > > expires property is set to date + 1 when creating.
    > > >
    > > > What should be done to delete the contents of the cookie? Should i
    > > > specify the domain as well as path when changing the expires property?
    > > > Thanks in advance
    Curt_C [MVP], Sep 17, 2003
    #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. _Who
    Replies:
    7
    Views:
    2,630
  2. Chumley the Walrus
    Replies:
    2
    Views:
    240
    Tom Gosselin
    Aug 10, 2004
  3. Stephanie Stowe
    Replies:
    2
    Views:
    198
    Peter X
    Apr 7, 2004
  4. Robert Mark Bram

    Page Expires - even on Back button?

    Robert Mark Bram, Aug 11, 2004, in forum: ASP General
    Replies:
    1
    Views:
    104
    Ray at
    Aug 11, 2004
  5. Brett
    Replies:
    26
    Views:
    223
    Dr J R Stockton
    Dec 22, 2009
Loading...

Share This Page