Using the HttpClient and the new System.Net.Http namespaces
HttpClient is a new .NET 4.5 class using the HTTP protocol, similar to
HttpWebRequest. A highlight of this class is the full support of Async.
In fact it's not such a novelty, since we already had it on the REST Starter Kit and the implementation of the .NET 4.0 We API.
HttpClient class resides on the
System.Net.Http namespace, which is a brand new .NET 4.5 namespace. Basically, we use
HttpClient to create HTTP requests, manage the response, and process the response's content.
Some of the most interesting capabilities are:
- Helper methods that create requests and process the responses
- The possibility of defining a default header to apply to all sent messages
- Timeout and cancellation ...