HttpClientHelper
public class HttpClientHelper { private const int TimeOutValue = 60000; public string GetAsync(string url) { HttpClientHandler handler = new HttpClientHandler { AutomaticDecompression = DecompressionMethods.GZip }; HttpClient client = new HttpClient(handler); client.Timeout = TimeSpan.FromMilliseconds(60000.0); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); return client.GetStringAsync(url).Result; } public string GetAsyncUri(string url) { HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromMilliseconds(60000.0); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); HttpResponseMessage result = client.GetAsync(url).Result; return result.RequestMessage.RequestUri.AbsoluteUri; } }