title: Add Custom Headers using HttpWebRequest
body: <p>I am not really sure what type of headers these highlighted values are, but how should I add them using HttpWebRequest?</p>
  
  <p><img src="https://i.stack.imgur.com/4M4QE.png" alt="HTTP Header"></p>
  
  <p>Is the highlighted part considered body of the http request or header data? In other words, which way is correct?</p>
  
  <p>Here is the code I am currently using:</p>
  
  <pre><code>HttpWebRequest request = (HttpWebRequest) WebRequest.Create("/securecontrol/reset/passwordreset");
  request.Headers.Add("Authorization", "Basic asdadsasdas8586");
  request.ContentType = "application/x-www-form-urlencoded";
  request.Host = "www.xxxxxxxxxx.com";
  request.Method = "POST";
  request.Proxy = null;
  request.Headers.Add("&amp;command=requestnewpassword");
  request.Headers.Add("&amp;application=netconnect");
  </code></pre>
  
  <p>But should I use the following instead to build the Http Request above?</p>
  
  <pre><code>string reqString = "&amp;command=requestnewpassword&amp;application=netconnect";
  byte[] requestData = Encoding.UTF8.GetBytes(reqString);
  
  HttpWebRequest request = (HttpWebRequest) WebRequest.Create("/securecontrol/reset/passwordreset");
  request.Headers.Add("Authorization", "Basic ashAHasd87asdHasdas");
  request.ContentType = "application/x-www-form-urlencoded";
  request.ContentLength = requestData.Length;
  request.Proxy = null;
  request.Host = "www.xxxxxxxxxx.com";
  request.Method = "POST";
  
  using (Stream st = request.GetRequestStream())
  st.Write(requestData, 0, requestData.Length);
  </code></pre>