日期:2014-05-18 浏览次数:20470 次
WebClient wc = new WebClient(); wc.DownloadFile(Url, filePath);
------解决方案--------------------
WebClient oWebClient = new WebClient();//声明 oWebClient.DownloadFile("http://www.csdn.net/Images/logo_csdn.gif", "d:\1.gif");//下载 oWebClient.Dispose();//释放
------解决方案--------------------
using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; namespace ConsoleApplication24 { class Program { static void Main(string[] args) { System.Net.WebClient wb = new System.Net.WebClient(); byte[] b=wb.DownloadData("http://profile.csdn.net/johnwoo85/picture/2.jpg"); System.IO.FileStream fs = new System.IO.FileStream(@"c:\aa.jpg", System.IO.FileMode.Create); fs.Write(b, 0, b.Length); fs.Close(); } } }