HttpUtility.cs
/// <summary>
/// Sends a GET request to the provided url.
/// </summary>
/// <param name="url">The url to GET the contents from.</param>
/// <returns>The response's content, or an exception if an error occurred.</returns>
Sends a GET request to the provided url.
Sends a GET request to the provided url .
public async Task<string> Get(string url)
        {
            using (HttpClient httpClient = new HttpClient())
            {
                var response = await httpClient.GetAsync(url);
                if (response.IsSuccessStatusCode)
                {
                    return await response.Content.ReadAsStringAsync();
                }
                else
                {
                    throw new Exception($"{response.StatusCode} '{url}'");
                }
            }
        }
public async Task < string > Get ( string url ) { using ( HttpClient httpClient = new HttpClient ( ) ) { var response = await httpClient . GetAsync ( url ) ; if ( response . IsSuccessStatusCode ) { return await response . Content . ReadAsStringAsync ( ) ; } else { throw new Exception ( $" { response . StatusCode }  ' { url } ' " ) ; } } }
Sends a GET request to the provided url.
Sends a GET request to the provided url .
The response's content, or an exception if an error occurred.
The response ' s content or an exception if an error occurred .
url
string
The url to GET the contents from.
The url to GET the contents from .