【问题标题】:how to download any file from the web using asp.net [closed]如何使用asp.net从网上下载任何文件[关闭]
【发布时间】:2016-12-27 22:11:19
【问题描述】:

我正在尝试做一些事情, 我想自动下载一些存储在 互联网,如照片视频图像等。 然后存储它们。

一些照片,我可以通过图形界面下载, 但我想要自动化 - 随时随地下载我想要的任何东西 通过一个非常具体的过程,我稍后会确定。

【问题讨论】:

    标签: javascript c# html


    【解决方案1】:

    使用WebClient对象以简单的方式下载文件:

    string remoteUri = "http://www.contoso.com/library/homepage/images/";
    string fileName = "ms-banner.gif", myStringWebResource = null;
    WebClient myWebClient = new WebClient();
    myStringWebResource = remoteUri + fileName;
    Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
    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);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-06
      • 2012-03-15
      • 2016-07-09
      • 1970-01-01
      • 2020-05-08
      • 1970-01-01
      • 2017-07-12
      相关资源
      最近更新 更多