CookieContainer GetCookies fails on multiple Set-Cookies

G

guyhey

I am accessing a site that passes the following headers:
Set-Cookie: ASP.NET_SessionId=pwdciy45i0c5me45urxjfoi0; path=/
Set-Cookie: LastSessID=pwdciy45i0c5me45urxjfoi0; expires=Tue,
01-Mar-2016 20:07:11 GMT; path=/
Set-Cookie: pubAccID=04; expires=Tue, 01-Mar-2016 20:07:11 GMT; path=/

I have verified this using ieHttpHeaders

When I use asp.net

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.AllowAutoRedirect = autoRedirect;
req.MaximumResponseHeadersLength = -1;
req.Timeout = timeout;
req.CookieContainer = new CookieContainer();
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
res.Cookies = req.CookieContainer.GetCookies(req.RequestUri);

It only captures "Set-Cookie:
ASP.NET_SessionId=pwdciy45i0c5me45urxjfoi0; path=/"

Am I doing something wrong? Is there a way for me to get all the
headers.

Thanks
 

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