WebRequest/WebResponse and Cookie

G

Guest

Hi

I am trying to do very simple http client that requires a login, copy cookie snet by a server and does a request with the cookies. WebRequest->CookieContainer/WebResponse->Cookies does not seems to handle cookie correctly.

User case: If a server send back cookies in headers that looks like following

Set-Cookie: a=assss
Set-Cookie: b=asddas
...

The WebResponse->Cookies only have one value from one Set-Cookie headers. Yes, you can still see all the values in all Set-Cookie in WebRespnose->Headers

Do I miss something
 
E

Eric Newton

WebRequest.Create with a HTTP or HTTPS scheme'd URI will actually return a
System.Net.HttpWebRequest instance.

HttpWebRequest has a CookieContainer-typed "Cookies" property... try using
that...

HTH


--
Eric Newton
eric.at.ensoft-software.com
www.ensoft-software.com
C#/ASP.net Solutions developer

Peter said:
Hi:

I am trying to do very simple http client that requires a login, copy
cookie snet by a server and does a request with the cookies.
WebRequest->CookieContainer/WebResponse->Cookies does not seems to handle
cookie correctly.
User case: If a server send back cookies in headers that looks like following:

Set-Cookie: a=assssa
Set-Cookie: b=asddasf
...

The WebResponse->Cookies only have one value from one Set-Cookie headers.
Yes, you can still see all the values in all Set-Cookie in
WebRespnose->Headers.
 

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