private async Task GetValueAsync()
{
try
{
using (WebClient client = new WebClient())
{
//地址
string path = $"{webUrl}/api/Value";
client.Headers.Add(HttpRequestHeader.Authorization, $"Bearer {token}");
string value = await client.DownloadStringTaskAsync(path);
txbMsg.Text = $"获取到数据={value}";
}
}
catch (Exception ex)
{
txbMsg.Text = $"获取数据出错={ex.Message}";
}
}