title: HTTP Request works in Postman, but not in C# code
body: <p>I want to do a simple HTTP request in C#, but something is not working and all I got is <code>403 Forbidden</code> status code.</p>
  
  <p>When I try to do same request in Postman, everything works fine.
  I tried to run Fiddler and see all headers that are being sent by Postman. I copy-pasted all of them, but i still got <code>403 Forbidden</code> in the request sent by C# code.</p>
  
  <h1>C# Code (Using <a href="https://flurl.dev" rel="noreferrer">https://flurl.dev</a>):</h1>
  
  <pre class="lang-cs prettyprint-override"><code>public static void Main(string[] args)
  {
      FlurlHttp.Configure(settings =&gt; {
          settings.HttpClientFactory = new MyClientFactory();
      });
  
      var url = "https://example.com"
          .AppendPathSegments(new[] { "v1", "oauth", "accesstoken" })
          .SetQueryParam("grant_type", "client_credentials")
          .AllowAnyHttpStatus()
          .WithBasicAuth("username", "password")
          .WithHeaders(new {
              User_Agent = "Something/0.4.0 Dalvik/2.1.0 (Linux; U; Android 5.1.1; SM-G975F Build/NRD90M)",
              X_Secret_Header = "secret_encoded_value",
              accept_encoding = "gzip, deflate",
              Accept = "*/*"
          });
  
      HttpResponseMessage msg = url.GetAsync().Result;
  
      Console.WriteLine("StatusCodeString: " + msg.StatusCode.ToString());
      Console.WriteLine();
      Console.WriteLine(msg.Content.ReadAsStringAsync().Result);
  }
  
  class MyClientFactory : DefaultHttpClientFactory
  {
      public override HttpMessageHandler CreateMessageHandler()
      {
          return new HttpClientHandler
          {
              AllowAutoRedirect = false
          };
      }
  }
  </code></pre>
  
  <h1>C# Request And Response:</h1>
  
  <p><img src="https://i.stack.imgur.com/5naFQ.jpg" alt="CSharp Request in Fiddler">
  <img src="https://i.stack.imgur.com/VEygo.jpg" alt="CSharp Response"></p>
  
  <h1>Postman Request And Response:</h1>
  
  <p><img src="https://i.stack.imgur.com/a4eSv.jpg" alt="Postman Headers">
  <img src="https://i.stack.imgur.com/xVmQ4.jpg" alt="Postman Response">
  <img src="https://i.stack.imgur.com/fWELy.jpg" alt="Postman Response in Fiddler"></p>
  
  <p>Can someone explain me why is this not working? Same headers, same everything.</p>
  
  <p><strong>I replaced the url with "example.com" because i don't want to show the real API URL here.</strong></p>
  
  <p>Also sorry for so many images.. I don't know how to show the problem here in other way.</p>