title: Can I send an empty HTTP POST WebRequest object from C# to IIS?
body: <p>Do I need to just slap some random garbage data in a <code>WebRequest</code> object to get by the HTTP status code 411 restriction on IIS?</p>
  
  <p>I have an HttpPost action method in an MVC 3 app that consumes a POST request with all the relevant information passed in the querystring (no body needed).</p>
  
  <pre><code>[HttpPost] public ActionResult SignUp(string email) { ... }
  </code></pre>
  
  <p>It worked great from Visual Studio's built in web host, Cassini. Unfortunately, once the MVC code was live on IIS [7.5 on 2008 R2], the server is pitching back an HTTP error code when I hit it from my outside C# form app.</p>
  
  <blockquote>
    <p>The remote server returned an error:
    (411) Length Required.</p>
  </blockquote>
  
  <p>Here is the calling code:</p>
  
  <pre><code>WebRequest request = WebRequest.Create("http://somewhere.com/signup/?email=a@b.com");
  request.Method = "POST";
  using (WebResponse response = request.GetResponse())
  using (Stream responseStream = response.GetResponseStream())
  using (StreamReader responseReader = new StreamReader(responseStream)) {
      // Do something with responseReader.ReadToEnd();
  }
  </code></pre>