How do you download data from an url in UWP? I'm used to using WebClient's DownloadData-method, but it can't be used anymore.
Asked
Active
Viewed 9,347 times
7
-
5Use HttpClient instead – Kevin Gosse Oct 14 '15 at 11:20
-
1As @KooKiz said, use HttpClient. Here is the [sample project from Microsoft](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/HttpClient). – Muster Station Oct 14 '15 at 14:17
1 Answers
10
.NET for UWP does not have the WebClient class.
But you have several alternative ways to download the data from URL in UWP.
For example:
var request = WebRequest.CreateHttp("http://www.bing.com");
var donnetClient = new System.Net.Http.HttpClient();
var winrtClient = new Windows.Web.Http.HttpClient();
If you want to download the data at background, you can use the BackgroundDownloader class

Jeffrey Chen
- 4,650
- 1
- 18
- 22
-
`HttpClient` seems better for future cross plat code. https://msdn.microsoft.com/en-us/windows/uwp/networking/httpclient?f=255&MSPPError=-2147217396 – JP Hellemons Sep 09 '16 at 14:30