4

I know of the following HTTP libraries:

  1. HttpWebRequest
  2. WebClient
  3. System.Net.Http.HttpClient
  4. Windows.Web.Http.HttpClient
  5. Microsoft.Net.Http

The first 3 are quite simple to place: WebClient vs HttpClient vs HttpWebRequest

The 4th is also not that complicated: Demystifying HttpClient APIs in the Universal Windows Platform

But where does Microsoft.Net.Http fit in?

Duanne
  • 734
  • 7
  • 14
  • It is part of Microsoft HTTP Client Libraries have a look here https://www.nuget.org/packages/Microsoft.Net.Http/ – Nkosi Oct 17 '16 at 15:18
  • @Nkosi, that doesn't really tell me anything about where it fits in in relation to the other APIs. – Duanne Oct 18 '16 at 05:03

2 Answers2

2

So according to all the feedback and articles referenced so far:

  1. HttpWebRequest - original HTTP API. Provides low-level control.
  2. WebClient - layer of abstraction over HttpWebRequest. Simpler to use, slightly slower performance.
  3. System.Net.Http.HttpClient - Layer of abstraction over HttpWebRequest that provides more features than the previous two options. Up to version 4.0.0.0 it was just for full .NET, nut since version 4.1.0 supports .NET Core
  4. Windows.Web.Http.HttpClient - a consolidation of HTTP API's from multiple languages (C#, VB, C++, JavaScript). Mainly used for multi-language Windows Store App developed so that only one API needs to be referenced.
  5. Microsoft.Net.Http - HTTP API that replaces System.Net.Http.HttpClient 2.0.2 or older. This is used to support older .NET applications.
Duanne
  • 734
  • 7
  • 14
  • HttpClient is *not* a replacement for HttpWebRequest, it *uses* HttpWebRequest. It's a replacement for WebClient. WebClient is simple to use only for downloading. It's harder to specify headers or make POST requests. HttpClient was created to make REST calls easy – Panagiotis Kanavos Oct 18 '16 at 13:30
  • @Panagiotis Kanavos thanks for the correction, I have updated accordingly. – Duanne Oct 18 '16 at 13:33
1

System.Net.Http vs Microsoft.Net.Http: Depends on the version. The old System.Net.Http packages (the 2.0 ones) are legacy packages which are deprecated in favor of Microsoft.Http.Net

So esentially 3 and 5 are the same. It's async http client that enables you to make asynchronous http requests and in comparison to WebClient it does work in multi-threaded environment.

Community
  • 1
  • 1
Pawel Troka
  • 853
  • 2
  • 12
  • 33
  • If Windows.Web.Http.HttpClient (#4) consolidates all Http APIs for Windows app languages (C#, VB, C++, JavaScript) and #5 replaces #3, then Windows.Web.Http.HttpClient should be updated as well . . – Duanne Oct 18 '16 at 06:26
  • 1
    Windows.Web.Http.HttpClient is for Windows Universal Apps. Newest version of System.Net.Http is dedicated for .NET Core instead. Old version of System.Net.Http (for FULL .NET Framework) is depracated now and you should use Microsoft.Net.Http. – Pawel Troka Oct 18 '16 at 08:55