I have 2 questions but they revolve around the same issue, namely timeout. I have the following piece of code:
public static async Task<string> GetHTMLDataAsync(string url)
{
HttpClient web = new HttpClient();
web.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
string responseBodyAsText = "";
try
{
HttpResponseMessage response = await web.GetAsync(url);
response.EnsureSuccessStatusCode();
responseBodyAsText = await response.Content.ReadAsStringAsync();
}
catch (Exception e)
{
// Error handling
}
return responseBodyAsText;
}
Which seems to work great. It calls the server and fetches resources. But sometime i get some strange null errors when i handle the response, and I am suspecting these to be caused by timeouts. Is there any way to modify the above piece of code to have 30 minutes timeout?
Second question, when doing xaml in wpf i create an Image. I set
Thank you in advance
Aucun commentaire:
Enregistrer un commentaire