This is the most basic example of using HttpClient to send a GET request. In the example we create an HttpClient instance, then create the HttpGet method (passing it the URL of the resource we would like to obtain), and then we execute the request by passing the GET method to the HttpClient Execute method.

The return parameter is the HttpResponse object, that holds the “response code” and the actual response content (in this case, is an HTML page).

using CodeScales.Http;
using CodeScales.Http.Entity;
using CodeScales.Http.Methods;

HttpClient httpClient = new HttpClient();
HttpGet httpGet = new HttpGet(new Uri("http://www.codescales.com"));
HttpResponse httpResponse = httpClient.Execute(httpGet);

Console.WriteLine("Response Code: " + httpResponse.ResponseCode);
Console.WriteLine("Response Content: " + EntityUtils.ToString(httpResponse.Entity));

In the console you will see as the result, the response code, and all the HTML of the page you were requesting. As you already understand you will not see any visual representation as a result of executing a request, but you get access to the markup that returns as part of the response.