2

In a scenario where you've potentially got two cookies with the same name but with different subdomains, one with WWW and the other without. Can you read one specifically? In this case the cookies domain was never explicitly set, however, when I check the browsers I often see what appear to be duplicate cookies with only the subdomain being different. Presumably at the time of creating the cookie the browser dictated the domain to assign it to.

So for example, the cookie is named 'test' and the domain is www.example.com

When I check my cookies I can see 'test' in .example.com and www.example.com

Is it possible in C# or Javascript to read in a named cookie from a specific subdomain?

I know I can use this in C#

Request.Cookies["test"]

But I believe this

Request.Cookies["test"].Domain 

Is only for setting the domain value.

Is there a reliable way I can check for and read the value of the www.example.com cookie?

Full Time Skeleton
  • 1,558
  • 1
  • 16
  • 34
  • Not sure is this what you mean (as you said, www is a subdomain): http://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain. – Jamie Phan Mar 13 '17 at 11:14
  • Interesting, I know the domain is not being set when these cookies are created. So, it appears that because the domain is not set I cannot dictate which cookie is read. – Full Time Skeleton Mar 13 '17 at 11:22

0 Answers0