日期:2014-05-17 浏览次数:20841 次
static void Main(string[] args) { CookieContainer cc = new CookieContainer(); HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.baidu.com"); request.CookieContainer = cc; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); foreach (Cookie c in response.Cookies) { Console.WriteLine(c.ToString()); } int s = cc.Count; Console.WriteLine(s); Console.ReadKey(); }