Five Great Reasons to Use the New HttpClient API to Connect to Web Services

Download this episode

Download Video


The new Windows.Web.Http.HttpClient family of classes lets you connect to web services easily and with lots of control. In this talk you’ll learn about these new classes, how and when to use them, how to connect to popular web services, and how to control your caches and cookies. You'll also learn new ways to speed up your app start-up by prudently pre-stocking your HTTP cache with data you know your users will want.
For more information, check out this course on Microsoft Virtual Academy:





Session Type:





South Hall: Gateway Ballroom 102



Available formats for this video:

Actual format may change based on video formats available and browser capability.

    The Discussion

    • User profile image

      where can I find windows.web.http (framework 4.5.1) namespace/library installed and later reference? Thanks

    • User profile image

      and you just mentioned having that namespace available in MSDN. I was looking for it and never found... could you provide the link?

    • User profile image

      jans: The new home of HttpClient is NuGet package Microsoft.Net.Http.

    • User profile image

      while selecting speakers for talks MS need to test their voices @ 2x speed. Some are just impossible to listen to @ 1.4x or @2x speeds like this speaker

    • User profile image

      Jans -- there are three HttpClient APIs in Windows.  This talk is all about the new 81. Window.Web.Http HttpClient; it's a WinRT component that works with C++, C#, VB and for JavaScript 'WWA' app store apps.  (It also works for desktop apps).


      There's also the .NET HttpClient that was introduced with 4.5, plus a Portable Class Library (PCL) HttpClient that just reached (IIRC) version 2.1 and which works with .NET 4.0.  But those are different.



    • User profile image

      can a filter be used to assign unique IP address to each instance of httpclient?

    • User profile image

      @WeCarpoolCOM: We don't give you quick that much power!  What scenario do you have that you need to assign IP addresses like this?

    • User profile image

      @PeSmith Where can we get that poster you provided at the talk?

    • User profile image

      3 questions: Can I do custom validation of the SSL certificate?  

      Can I do custom validation of the SSL connection?  I want to be aware of BEAST, CRIME, and other vulnerabilities my client is open to.  (see ).  Related questions: Am I using TLS 1.0 or 1.1?  What cipher and encryption is the connection using?

      Can I check the "issued by" parameter of each SSL certificate?  I want to determine if an in-line SSL proxy filter is inspecting my traffic (Bluecoat corporate proxy)

      How many concurrent connections are allowed to the same fqdn?  Traditionally, in IE and javascript I am limited to the number of concurrent HTTP calls I can have to a given domain.  How is this limitation applied to C# and the other platforms?

    • User profile image

      The forums at are a great place to ask questions like these -- the moderators are very active at answering questions.

      Yes, you get some information about the SSL connection.  In particular the HttpRequestMessage has a TranportInformation property that includes the SSL certificate.  For validation, I'd recommend creating a simple filter that, on getting a response, checks the responses' httpRequest message for the transport information.  If you decide that the SSL isn't good enough, you can then just kill the response entirely.  By placing the check in a filter, you can have a good check without having to clutter up the rest of your app logic.

      The TransportInformation ServerCertificate is an ordinary Windows.Security.Cryptography.Certificates.Certifcate object.  That object includes an Issuer.

      You can control the number of connection with the HttpBaseProtocolFilter "MaxConnectionsPerServer" value.


    • User profile image

      We passed out a nifty poster at this session (and then later at one of the booths in the Big Room).  An enhanced version of that poster is now on the Download Center; check it out at

      The poster prints out at 11x17 ("tabloid") size.  The poster includes the various classes that make up the HttpClient family of classes and how they interrelate and includes 5 small code samples that demonstrate using the classes.


    Comments closed

    Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.