Can't expire cookie with domain attribute set.

Discussion in 'ASP .Net Web Services' started by Serge, Apr 25, 2006.

  1. Serge

    Serge Guest

    Good Day Folks,

    Setting the domain attribute when creating a cookie, see code below, seems
    to create a problem that I can't expire the cookie later, see 2nd code block.
    If I don't set the domain attribute, then expiring the cookie works as
    expected. Unfortunately I need to set the domain attribute because the
    cookie needs to exist accross multiple servers. Any ideas on how to expire a
    cookie which was created using the following code. Thanks in advance. Serge.

    ' Create cookie
    Response.cookies("Cookietest")("p_userid")="jdoe"
    Response.cookies("Cookietest")("p_password")="test"
    Response.cookies("Cookietest").domain="ocdsb.ca"

    ' Expire/delete cookie.
    Dim aCookie As HttpCookie
    aCookie = Request.Cookies("Cookietest")
    aCookie.Expires = DateTime.Now.AddDays(-1)
    Response.Cookies.Add(aCookie)
    Serge, Apr 25, 2006
    #1
    1. Advertising

  2. Serge

    Josh Twist Guest

    Josh Twist, Apr 25, 2006
    #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. Amil
    Replies:
    4
    Views:
    510
  2. UJ
    Replies:
    0
    Views:
    346
  3. Amil
    Replies:
    1
    Views:
    126
    Dominick Baier [DevelopMentor]
    Jul 22, 2005
  4. Tongass Park Neighborhood Association, Juneau Alas

    Cookies expire immediately, not when set to expire

    Tongass Park Neighborhood Association, Juneau Alas, Oct 1, 2009, in forum: ASP General
    Replies:
    2
    Views:
    1,198
    SQLDude
    Nov 24, 2009
  5. Phil Powell

    This doesn't "set" a cookie to expire - why?

    Phil Powell, Feb 8, 2006, in forum: Javascript
    Replies:
    23
    Views:
    242
Loading...

Share This Page