c# modelbinding Why is there both a System.Net.Http and System.Web.Http namespace?

using system web http dll (3)

Just a simple question as I'm studying the various class libraries available in .NET. I noticed that there's a System.Net.Http namespace and a System.Web.Http namespace.

  • What purpose(s) do both namespaces serve?
  • What were the motivations for creating two seemingly ambiguous namespaces?
  • Is there any history I should know about or is one of the namespaces "deprecated"?

System.Net.Http, System.Web.Http

From my experience, the separation between the two namespaces becomes clear when you look at the difference between self hosted webapi services vs IIS-hosted. Self hosted only requires System.Http, whilst IIS hosted needs both. See Difference between "MapHttpRoute" and "MapRoute"? for a similar discussion and useful links.

So, the reason there are two is so that you can create a self-hosted web service that doesn't depend on the entire ASP.NET stack.

Neither of them are deprecated.

I haven't seen an official Microsoft explanation for this, but that's the best I've been able to find.

System.Net.Http is for client-side HTTP programming. System.Web.Http is for server-side HTTP programming.

System.Net.Http relates to network programming while System.Web.Http relates specifically to programming for the web.