1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 |
public
void
temp1() { 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" ; 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(); //} } } |
原文:http://www.cnblogs.com/songxxu/p/3616377.html