Hello,
I would like to create a cookie upon login that can be read on two different subdomains. I have achieved this. The problem that I am having is that I am unable to delete the cookie upon logout, as it can still be read even after it is deleted. Here is the code:
At login the cookie is set from a.mydomain.com:
c#
Cookie reading on subdomain (y.x.mydomain.com) vbscript
Happens back at a.mydomain.com
Logout:
However when I go back to y.x.mydomain.com, the cookie value still show up as what it was initially set to.
Can anyone shed some light onto why I can't seem to be able to delete the cookie.
I would like to create a cookie upon login that can be read on two different subdomains. I have achieved this. The problem that I am having is that I am unable to delete the cookie upon logout, as it can still be read even after it is deleted. Here is the code:
At login the cookie is set from a.mydomain.com:
c#
Code:
HttpCookie cookie = new HttpCookie("my_cookie");
cookie.Value = "test";
cookie.Domain = ".mydomain.com";
Response.Cookies.Add(cookie);
Cookie reading on subdomain (y.x.mydomain.com) vbscript
Code:
myVal = Request.Cookies("my_cookie")
Happens back at a.mydomain.com
Logout:
Code:
Request.Cookies["my_cookie"].Domain = ".mydomain.com";
Request.Cookies["my_cookie"].Expires = DateTime.MinValue;
However when I go back to y.x.mydomain.com, the cookie value still show up as what it was initially set to.
Can anyone shed some light onto why I can't seem to be able to delete the cookie.