I\'m struggling to figure out what is wrong here. I\'m sending login information, I can see the Set-Cookie in the Header with the correct value, but the Cookies collection
It seems like Set-Cookie header sent by the website is malformed (Not in the typical format it should have been).
In such case you need to Parse cookie manually and it it to the CookieContainer.
for (int i = 0; i < b.Headers.Count; i++)
{
string name = b.Headers.GetKey(i);
string value = b.Headers.Get(i);
if (name == "Set-Cookie")
{
Match match = Regex.Match(value, "(.+?)=(.+?);");
if (match.Captures.Count > 0)
{
reqCookies.Add(new Cookie(match.Groups[1].Value, match.Groups[2].Value, "/", "example.com"));
}
}
}