1、局域网文件下载:


1 public class RemoteDownload 2 { 3 public static void DownLoad(string addressUrl,string localName) 4 { 5 //下载文件 6 System.Net.WebClient myWebClient = new System.Net.WebClient(); 7 myWebClient.DownloadFile(@"/10.2.0.254/software/01279.lic.txt", "testdownload.txt"); 8 //下载end 9 } 10 }
2、通过web方式,从远程服务器端下载文件:


1 public class WebDownload 2 { 3 public static void DownLoad(string Url, string FileName) 4 { 5 bool Value = false; 6 WebResponse response = null; 7 Stream stream = null; 8 9 try 10 { 11 HttpWebRequest request =