title: HttpClient vs HttpWebRequest for better performance, security and less connections
body: <p>I discovered that a single HttpClient could be shared by multiple requests. If shared, and  the requests are to the same destination, multiple requests could reuse the connections. WebRequest needs to recreate the connection for each request.</p>
  
  <p>I also looked up some documentation on other ways to use HttpClient in examples.</p>
  
  <p>The following article summarizes the high-speed NTLM-authenticated connection sharing: <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.unsafeauthenticatedconnectionsharing%28v=vs.110%29.aspx" rel="noreferrer">HttpWebRequest.UnsafeAuthenticatedConnectionSharing</a>
   </p>
  
  <p>Possible implementations that I tried out are shown below </p>
  
  <p>A)</p>
  
  <pre><code>private WebRequestHandler GetWebRequestHandler()
  {
      CredentialCache credentialCache = new CredentialCache();
      credentialCache.Add(ResourceUriCanBeAnyUri, "NTLM", CredentialCache.DefaultNetworkCredentials);
      WebRequestHandler handler = new WebRequestHandler
      {
          UnsafeAuthenticatedConnectionSharing = true,
          Credentials = credentialCache
      };
  
      return handler;
  }
  
  using (HttpClient client = new HttpClient(GetWebRequestHandler(), false))
  {
  }
  </code></pre>
  
  <p>B)</p>
  
  <pre><code>using (HttpClient client = new HttpClient)
  {
  }
  </code></pre>
  
  <p>C)</p>
  
  <pre><code>HttpWebRequest req = (HttpWebRequest)WebRequest.Create("some uri string")
  </code></pre>
  
  <p>I would appreciate any help in making me understand which approach I should  take so as to achieve max performance, minimizing connections and making sure security is not impacted.</p>