title: HttpClient add Host and UserAgent into request in c#
body: <p>I have to add Host and User Agent to my request but there is no a function like "Host" or "User Agent"</p>
  
  <p>without host I have unauthorized.. 
  "WebException: The remote server returned an error: (401) Unauthorized."
  my code:</p>
  
  <pre><code>var webRequest = WebRequest.Create(url) as HttpWebRequest;
              if (webRequest != null)
              {
                  webRequest.Accept = "*/*";
                  webRequest.UserAgent = ".NET";
                  webRequest.Method = WebRequestMethods.Http.Post;
                  webRequest.ContentType = "application/json";
                  webRequest.Host = "coinbase.com";
  
                  var whc = new WebHeaderCollection
                  {
                      "ACCESS_KEY: " + API_KEY,
                      "ACCESS_SIGNATURE: " + signature,
                      "ACCESS_NONCE: " + nonce
                  };
                  webRequest.Headers = whc;
  
                  using (WebResponse response = webRequest.GetResponse())
                  {
                      using (Stream stream = response.GetResponseStream())
                      {
                          StreamReader reader = new StreamReader(stream);
                          returnData = reader.ReadToEnd();
                      }
                  }
              }
  </code></pre>
  
  <p>Screen of my code:
  <a href="https://i.stack.imgur.com/Hmlkq.png" rel="nofollow noreferrer">screen</a></p>