title: WebRequest Equivalent to CURL command
body: <p>I am banging my head against a wall trying to convert a working curl command to a c# WebRequest.</p>
  
  <p>I have read through quite a few postings and I <em>was</em> pretty sure I had the code right but it still will not work.</p>
  
  <p>Can anyone see what I am doing wrong please?</p>
  
  <p>Here is the working curl command:</p>
  
  <pre><code>curl -k -u x:reallylongstring -H "Content-Type: application/json"  https://api.somewhere.com/desk/external_api/v1/customers.json
  </code></pre>
  
  <p>And this is the code I have written in c#:</p>
  
  <pre><code>WebRequest wrGETURL;
  wrGETURL = WebRequest.Create("https://api.somewhere.com/desk/external_api/v1/customers.json");
  wrGETURL.Method = "GET";
  wrGETURL.ContentType = "application/json"; 
  wrGETURL.Credentials = new NetworkCredential("x", "reallylongstring");
  Stream objStream = wrGETURL.GetResponse().GetResponseStream();
  StreamReader objReader = new StreamReader(objStream);
  string responseFromServer = objReader.ReadToEnd();
  </code></pre>
  
  <p>But the api responds:</p>
  
  <pre><code>The remote server returned an error: (406) Not Acceptable.
  </code></pre>
  
  <p>Any help would be much appreciated!</p>
  
  <p>Thanks</p>