Download file from URL to a string

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

    See WebClient.DownloadString. Note there is also a WebClient.DownloadStringAsync method, if you need to do this without blocking the calling thread.

提交回复
热议问题