总裁的一周恋人漫画:谁能告诉我c#如何保存网站的附加码图片到本地硬盘中

来源:百度文库 编辑:高考问答 时间:2024/05/14 18:10:21
原来我是用这个直接写屏:
public byte[] images(string url,string cookie,string refe)
{
WebClient myWebClient = new WebClient();
myWebClient.Headers.Add("Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-powerpoint, application/vnd.ms-excel, */*");
myWebClient.Headers.Add("Accept-Language: zh-cn");
myWebClient.Headers.Add("Accept-Encoding: gzip, deflate");
myWebClient.Headers.Add("User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)");
myWebClient.Headers.Add("Cookie: "+cookie);
myWebClient.Headers.Add("Referer:"+refe);
byte[] myDataBuffer = myWebClient.DownloadData(url);
myWebClient.Dispose();
return myDataBuffer;
}