title: .NET HTTP GET with Body
body: <p>I require to send a HTTP GET request with a content body. Yes I know this is frowned upon but it is technically a legal transaction.</p>
  
  <p>Currently the .NET WebRequest class will fail when attempting to get the request stream as shown below.</p>
  
  <pre><code>string url = "https://someplace.com/api";
  var wr = WebRequest.Create(url);
  wr.Method = "GET";
  
  string json = JsonConvert.SerializeObject(query);
  byte[] byteData = Encoding.UTF8.GetBytes(json);
  
  using (var req = wr.GetRequestStream()) // Exception thrown here
  {
    req.Write(byteData, 0, byteData.Length);
    req.Flush();
  }
  </code></pre>
  
  <p>What other options do I have?</p>
  
  <p>The equivalent CURL command is:</p>
  
  <pre><code>curl -XGET 'localhost:9200/twitter/tweet/_search?pretty' -d'
  {
      "query" : {
          "term" : { "user" : "kimchy" }
      }
  }'
  </code></pre>