Can't expire cookie with domain attribute set.

S

Serge

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)
 
J

Josh Twist

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top