网上地址下载图片
public void temp1() { string strURL = "http://McH2N0M1PCn1QYh8"; string strName = "download.jpg"; System.Net.WebClient myWebClient = new System.Net.WebClient(); string name = Server.MapPath(strName); myWebClient.DownloadFile(strURL, name); } public void temp2() { const string filePath = @"E:\\a.jpg"; Uri rl = new Uri("http://file2N0M1PCn1QYh8"); using (WebClient wc = new WebClient()) { wc.DownloadFile(rl, filePath); //string html = wc.DownloadString(url); //using (StreamWriter writer = new StreamWriter(filePath, false, wc.Encoding)) //{ // writer.Write(html); // writer.Flush(); //} } }