cookie转CookieCollection

CookieCollection cookiesResponse = new CookieCollection();

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

 

posted on 2013-07-02 00:02  HOT SUMMER  阅读(1624)  评论(0编辑  收藏  举报

导航