views:

607

answers:

0

I've just had a small nightmare with unwanted cookies somehow being created. I swear my code never created a cookie in a certain virtual directory, it just read it, but somehow my browser ended up with a root cookie and a copy of this cookie for the vdir too. Which meant the two values were separate and did not both get updated.

Most articles about deleting cookies say to set it to blank, which is no help, as it will still exist!

I had to write a short ASP to set the cookie expiry to last year, and also make sure I specified the path as the vdir in question, to make sure it killed the one I didn't want.

Response.Cookies("BWWF2")("UID") = ""
Response.Cookies("BWWF2").Path = "/community"
Response.Cookies("BWWF2").Expires = DateAdd("yyyy", -1, Now())

Hopefully this has solved the problem, but I wanted to share this here, and also ask if anyone has a better way to solve the issue, or any ideas on how the problem (two cookies) might have happened in the first place?!