2

Hey I am developing side project for Universal Windows Platform that will target Windows 10 Mobile phones (mainly). In this app I often ask web service to get and post data with use of HttpClient class.

Now I am confused because some examples shows that you should use class HttpClient from namespace: Windows.Web.Http, and some from System.Net.Http. Methods are different between them, but I think you can achieve same results.

My question is which namespace I should use while developing such applications?

Eldho
  • 7,795
  • 5
  • 40
  • 77
hal9k2
  • 127
  • 1
  • 11
  • Possible duplicate of [System.Net.Http.HttpClient vs Windows.Web.Http.HttpClient - What are the main differences?](http://stackoverflow.com/questions/31291008/system-net-http-httpclient-vs-windows-web-http-httpclient-what-are-the-main-di) – kiewic Nov 19 '15 at 15:49

1 Answers1

3

Windows.Web.Http is a WinRT API available in all the WinRT programming languages supported: C#, VB, C++/CX and JavaScript. This enables the option to write the same code in the language of your choice.

System.Net.Http is a .NET API, and it is only available for C# and VB developers.

The new API is better capable handling new methods related to the HTTP protocol, like WebSockets, etc.

The new API doesn't have dependencies to some low-level Windows functions, like the current API does.

Your question has been answered before , please look this , I hope this would help you .

Community
  • 1
  • 1
John Zhang
  • 354
  • 2
  • 13