title: c# HttpWebRequest POST'ing failing
body: <p>So i'm trying to POST something to a webserver.</p>
  
  <pre><code>System.Net.HttpWebRequest EventReq = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create("url");
  System.String Content = "id=" + Id;
  EventReq.ContentLength = System.Text.Encoding.UTF8.GetByteCount(Content);
  EventReq.Method = "POST";
  EventReq.ContentType = "application/x-www-form-urlencoded";
  System.IO.StreamWriter sw = new System.IO.StreamWriter(EventReq.GetRequestStream(), System.Text.Encoding.UTF8);
  sw.Write(Content);
  sw.Flush();
  sw.Close();
  </code></pre>
  
  <p>Looks alright, i'm setting content-length based on the size of the ENCODED data...
  Anyway it fails at sw.flush() with "bytes to be written to the stream exceed the Content-Length size specified"</p>
  
  <p>Is StreamWriter doing some magic behind my back i'm not aware of? Is there a way i can peer into what StreamWriter is doing?</p>