如何从 windows phone 8 中的 HTTPS 网站下载字符串
How to download string from HTTPS website in windows phone 8
我是 windows phone 开发人员,我想从 HTTPS 网站下载字符串,我使用
WebClient most_down_download = new WebClient();
most_down_download.DownloadStringCompleted += Most_down_download_DownloadStringCompleted;
most_down_download.DownloadStringAsync(new Uri(https_url));
但它不起作用。你能帮帮我吗?
也许是这样的?使用 HTTP 客户端而不是 Web 客户端 (8.1)
HttpClient http = new System.Net.Http.HttpClient();
HttpResponseMessage response = await http.GetAsync(https_url);
webresponse = await response.Content.ReadAsStringAsync();
Reference here
您需要生成 Most_down_download_DownloadStringCompleted
事件处理程序,如下所示
void Most_down_download_DownloadStringCompleted(object sender,
System.Net.DownloadStringCompletedEventArgs e)
{
try
{
if (e.Error == null)
{
string response = e.Result.ToString();
}
}
catch (Exception ex)
{ }
}
在 e.Result.ToString()
中,您从网站获取字符串
我是 windows phone 开发人员,我想从 HTTPS 网站下载字符串,我使用
WebClient most_down_download = new WebClient();
most_down_download.DownloadStringCompleted += Most_down_download_DownloadStringCompleted;
most_down_download.DownloadStringAsync(new Uri(https_url));
但它不起作用。你能帮帮我吗?
也许是这样的?使用 HTTP 客户端而不是 Web 客户端 (8.1)
HttpClient http = new System.Net.Http.HttpClient();
HttpResponseMessage response = await http.GetAsync(https_url);
webresponse = await response.Content.ReadAsStringAsync();
Reference here
您需要生成 Most_down_download_DownloadStringCompleted
事件处理程序,如下所示
void Most_down_download_DownloadStringCompleted(object sender,
System.Net.DownloadStringCompletedEventArgs e)
{
try
{
if (e.Error == null)
{
string response = e.Result.ToString();
}
}
catch (Exception ex)
{ }
}
在 e.Result.ToString()
中,您从网站获取字符串