How to get cookies of "foo.com" from the CookieContainer?

  • Thread starter Thread starter Sin Jeong-hun
  • Start date Start date
S

Sin Jeong-hun

Hello.

I used the same CookieContainer for several consecutive WebRequests,
then I could see that it contains cookies for several domains. I
examined the private m_domains and it contains a domain
".foo.com" (foo is not the actual domain name, of course). The HTTP
response which made that cookie was something like,
SET-COOKIE : ...., domain : foo.com;

Now, I wanted to retrieve that cookie value, but all these failed,
theCookieContainer.GetCookies(new Uri("foo.com"))
theCookieContainer.GetCookies(new Uri("http://foo.com"))
theCookieContainer.GetCookies(new Uri(".foo.com"))
GetCookie has no overload, and there seemed to be no other way to get
cookies from the CookieContainer (such as enumeration or index)

I was wondering if you could give me any advice.
 
Browser (client) send only cookies from current location (domain
name).

Look at the http specification so you shouldn't read cookies from
different domain name.

Regards
 
Back
Top