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

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.
 
K

Korszuñ Rafa³

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top