I’m having a problem where I’m adding a persistent cookie using Response.Cookies.Add(cookie) but this seems to be adding the value if the user already has a cookie with that name. I think end up with multiple values in the cookie, which is not what I want. Should I be using .Set instead?
Note that the cookie may contain a value from a previous visit and I wish to overwrite it with a new value, not keep multiple values.
I discovered the reason for this is that if you have a cookie
xand .mydomain.com and try to set another cookiexat .subdomain.mydomain.com you end up with both values when you read the cookiexfrom .subdomain.mydomain.com. The choice ofAddvsSetisn’t relevent to my problem then, it was just me misunderstanding how cookies and subdomains interact.