Download file from URL to a string

前端 未结 5 496
渐次进展
渐次进展 2020-12-05 17:03

How could I use C# to download the contents of a URL, and store the text in a string, without having to save the file to the hard drive?

5条回答
  •  感情败类
    2020-12-05 17:45

    string contents;
    using (var wc = new System.Net.WebClient())
        contents = wc.DownloadString(url);
    

提交回复
热议问题