Download file from URL to a string

前端 未结 5 493
渐次进展
渐次进展 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:48

    use this Code Simply

    var r= string.Empty;
    using (var web = new System.Net.WebClient())
           r= web.DownloadString("http://TEST.COM");
    

提交回复
热议问题