(UWP)WebClient并从URL中下载数据 [英] (UWP) WebClient and downloading data from URL in

查看:123
本文介绍了(UWP)WebClient并从URL中下载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从UWP中的URL下载数据?我已经习惯了使用WebClient的DownloadData方法,但是现在无法使用了.

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.

推荐答案

用于UWP的.NET没有WebClient类.

.NET for UWP does not have the WebClient class.

但是您可以通过其他几种方式从UWP中的URL下载数据.

But you have several alternative ways to download the data from URL in UWP.

例如:

    var request = WebRequest.CreateHttp("http://www.bing.com");

    var donnetClient = new System.Net.Http.HttpClient();

    var winrtClient = new Windows.Web.Http.HttpClient();

如果要在后台下载数据,可以使用 BackgroundDownloader课

If you want to download the data at background, you can use the BackgroundDownloader class

这篇关于(UWP)WebClient并从URL中下载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆