title: .NET httpclient 406 not acceptable
body: <p>I am trying to make a http get call using .NET and I am getting 406 Not accepted error.
  The same request when I try to do from PostMan its working fine!
  I have tried verifying my headers and also mapped it with the same postman request (including the postman's hidden auto-generated headers.
  Tried with different accept headers also. Nothing worked, can someone point me in some direction how I can identify the issue. Unfortunately I dont have any control over the server endpoint.</p>
  <p>My .NET console app code is this!</p>
  <pre><code>            HttpClient httpClient = new HttpClient();
              httpClient.BaseAddress = new Uri(BaseURL + &quot;reports/1.0/&quot;);
              httpClient.DefaultRequestHeaders.Add(&quot;consumerKey&quot;, ConsumerKey);
              httpClient.DefaultRequestHeaders.Add(&quot;Authorization&quot;, &quot;Bearer &quot; + AccessToken);
              httpClient.DefaultRequestHeaders.TryAddWithoutValidation(&quot;sessionToken &quot;, ott);
              httpClient.DefaultRequestHeaders.Add(&quot;User-Agent&quot;, &quot;PostmanRuntime/7.29.0&quot;);
              httpClient.DefaultRequestHeaders.Add(&quot;Accept-Encoding&quot;, &quot;gzip, deflate, br&quot;);
              httpClient.DefaultRequestHeaders.Add(&quot;Connection&quot;, &quot;keep-alive&quot;);
              httpClient.DefaultRequestHeaders.Add(&quot;Accept&quot;, &quot;*/*&quot;);
  
              var response = await httpClient.GetAsync(&quot;orders&quot;);
              response.EnsureSuccessStatusCode();
  </code></pre>
  <p>Request from postman console looks like this.
  <a href="https://i.stack.imgur.com/43Vzv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/43Vzv.png" alt="Request from postman console looks like this" /></a></p>
  <p>Same request from Postman's raw log</p>
  <pre><code>GET /apim/reports/1.0/orders HTTP/1.1
  consumerKey: L3UnAkofqNfW0rhgtYUz7UQzN58a
  sessionToken: DA05DA9F178D8C0E5754F03E617A49546330776ABFDDBC
  Accept: application/xml
  Authorization: Bearer 6971ce62-789e-3b1b-b805-82560f1f21c6
  Postman-Token: 04df336c-9226-4eab-8054-c004940e4660
  
  HTTP/1.1 200 OK
  Strict-Transport-Security: max-age=15768000; includeSubDomains
  Access-Control-Expose-Headers:
  Access-Control-Allow-Origin: *
  Access-Control-Allow-Methods: GET
  Timestamp: 46
  Access-Control-Allow-Headers: authorization,Access-Control-Allow-Origin,Content-    Type,SOAPAction,consumerKey,sessionToken,Authorization
  Content-Type: application/json
  Date: Sun, 22 May 2022 10:57:28 GMT
  Transfer-Encoding: chunked
  </code></pre>
  <p>The failing request from Visual Studio seems like having 200 in the fiddler! Below is the response of failing request captured in fiddler.</p>
  <pre><code>HTTP/1.1 200 Connection Established
  FiddlerGateway: Direct
  StartTime: 18:13:22.888
  Connection: close
  
  This is a CONNECT tunnel, through which encrypted HTTPS traffic flows.
  To view the encrypted sessions inside this tunnel, enable the Tools &gt; Options &gt; HTTPS &gt; Decrypt HTTPS traffic option.
  
  A SSLv3-compatible ServerHello handshake was found. Fiddler extracted the parameters below.
  </code></pre>
  <p>Here is the Visual Studio error I receive.</p>
  <p><a href="https://i.stack.imgur.com/lIZN5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lIZN5.png" alt="VS Error" /></a></p>
  <p>Any suggestions on what can be the issue or how I can troubleshoot will be of great help! Please advise.</p>