|
string _UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36";
string url = "http://log.mmstat.com/2.gif";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Accept = "text/html, application/xhtml+xml, */*";
req.AutomaticDecompression = DecompressionMethods.GZip;
req.Headers["Accept-Language"] = "zh-CH;en-US";
req.UserAgent = _UserAgent;
req.Method = "GET";
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
int CookieCount = res.Cookies.Count;
这是请求某一个图片时用到的代码,用IE9 F12能清楚的看到有Set-Cookie但是 源码中CookieCount为0,不知道是什么原因,请赐教
|
|