如何在应用程序 C# 中为 Windows Iot 创建从 Visual Studio 2015 获取 url

how create get url from Visual Studio 2015 for Windows Iot in app C#

如何在应用 C#(通用应用 Windows)Windows 中为 Windows Iot 创建从 Visual Studio 2015 获取 url

Getreponse(); 来自 c# 2015 已弃用

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://XXX/online?check=useronline");
request.Method = "GET";
using (var response = request.GetResponse())
using (var stream = response.GetResponseStream())
using (var reader = new StreamReader(stream))

你可以看看这个例子

https://ms-iot.github.io/content/en-US/win10/samples/BlinkyWebServer.htm

所有请求都来自一个函数,因此可以轻松使用 reqex 并制作您的 Web 服务。

Universal App Platform 对 HTTP 有很好的class。

HttpClient 拥有您只需几行代码即可获得 Web 资源所需的一切。

var client = new HttpClient();
var content = await client.GetStringAsync(new Uri("http://danvy.tv"));

在此处查看详细信息

https://msdn.microsoft.com/en-US/library/windows/apps/xaml/windows.web.http.httpclient.getstringasync