HTTPClientを使用してGetAsync()を実行し、そこから出力されるステータスコードをチェックする方法があります。
時間の制約に応じて、自然にタイムアウトするのを待つか、キャンセルトークンを渡してデフォルトより早く破棄することができます。
(わずかに修正)https://docs.microsoft.com/en-us/windows/uwp/networking/httpclientここから:
//Send the GET request asynchronously and retrieve the response as a string.
Windows.Web.Http.HttpResponseMessage httpResponse = new Windows.Web.Http.HttpResponseMessage();
string httpResponseBody = "";
try
{
//Send the GET request
httpResponse = await httpClient.GetAsync(requestUri);
if(httpResponse.IsSuccessStatusCode) { /* Do something with it */ }
else { /* Do fallback here */ }
}
catch (Exception ex)
{
httpResponseBody = "Error: " + ex.HResult.ToString("X") + " Message: " + ex.Message;
}
すでに私の現在のソリューションであること - 私はそこよりエレガントな何かがあるかもしれないと思いました。 – Christoph