title: WebRequest will not pass headers
body: <p>i have trolled and tried everything, i have done this 100's of times before without issues but now im stumped.</p>
  
  <p>I simply want to pass header info from a webrequest.</p>
  
  <p>The client runs separately and connects to a wcf rest service.  The service has this code which gets hit:            </p>
  
  <pre><code>HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Authorization, Origin, Content-Type, Accept, X-Requested-With");
  </code></pre>
  
  <p>The client has this:</p>
  
  <pre><code>    var client = WebRequest.Create(url);
      client.Method = type.ToString().ToUpper();
      client.ContentType = "application/json";
      client.ContentLength = bytes.Length;
      client.Headers.Add(String.Format("Authorization: {0}", "test12345"));
  </code></pre>
  
  <p>I have also tried for example:</p>
  
  <pre><code>    client.Headers["X-Requested-With"] = "test1234";
      client.Headers["Authorization"] = "test1234";
  </code></pre>
  
  <p>No matter how i try and set the headers they are never passed.  When I look at the request in fiddler, Authorization is NEVER there.  I have also tried to send X-Requested-With, etc... but no matter what the header will not pass.</p>
  
  <p>Thanks in advance.</p>
  
  <p>UPDATE:
  I found the issue, but not the solutions:
  <a href="https://stackoverflow.com/questions/27022647/webrequest-will-not-pass-headers-from-asp-net-mvc">WebRequest will not pass headers when used from within ASP.NET MVC controller</a></p>