Fastest C# Code to Download a Web Page

后端 未结 6 1041
不思量自难忘°
不思量自难忘° 2021-01-30 06:31

Given a URL, what would be the most efficient code to download the contents of that web page? I am only considering the HTML, not associated images, JS and CSS.

6条回答
  •  情歌与酒
    2021-01-30 06:58

    public static void DownloadFile(string remoteFilename, string localFilename)
    {
        WebClient client = new WebClient();
        client.DownloadFile(remoteFilename, localFilename);
    }
    

提交回复
热议问题