So I'm following this tutorial: http://www.asp.net/web-api/overview/web-api-clients/calling-a-web-api-from-a-net-client and I wonder how I can see whether the website where I connect to is offline.
This is the code I've got
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("http://localhost:54932/");
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = client.GetAsync("api/products").Result;
Console.WriteLine("here");
When the url http://localhost:54932/
is online everything works just fine, and here
is printed. Yet when the website is offline, the here
is not printed. How can I know if the ip adres is down?