WebRequest/WebResponse and Cookie

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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.
 
Back
Top