cookie转CookieCollection

时间:2022-04-05 06:44:28
CookieCollection cookiesResponse = new CookieCollection();

if (response != null)
{
foreach (string cookie in response.Headers["Set-Cookie"].Split(';'))
{
string name = cookie.Split('=')[];
string value = cookie.Substring(name.Length + );
cookiesResponse.Add(new Cookie(name.Trim(), value.Trim(), path, domain));
}
}