在程序里如何下载文件??

acai 2003-12-17 12:30:40
比如从网络某处下载一个程序,代码该如何写呢??
...全文
60 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
dahuzizyd 2003-12-17
  • 打赏
  • 举报
回复
http://www.c-sharpcorner.com/1/filedownloader.asp
dahuzizyd 2003-12-17
  • 打赏
  • 举报
回复
http://www.c-sharpcorner.com/Internet/UploadDownlaodWebFilesSAD.asp
速马 2003-12-17
  • 打赏
  • 举报
回复
说白了就是WebClient类的使用
速马 2003-12-17
  • 打赏
  • 举报
回复
Example
The following example downloads a file from http://www.contoso.com to the local hard drive.

string remoteUri = "http://www.contoso.com/library/homepage/images/";
string fileName = "ms-banner.gif", myStringWebResource = null;
// Create a new WebClient instance.
WebClient myWebClient = new WebClient();
// Concatenate the domain with the Web resource filename.
myStringWebResource = remoteUri + fileName;
Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
// Download the Web resource and save it into the current filesystem folder.
myWebClient.DownloadFile(myStringWebResource,fileName);
Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + Application.StartupPath);

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧