title: Sending File in Chunks to HttpHandler
body: <p>I'm trying to send a file in chunks to an HttpHandler but when I receive the request in the HttpContext, the inputStream is empty. </p>
  
  <p>So a: while sending I'm not sure if my HttpWebRequest is valid
  and b: while receiving I'm not sure how to retrieve the stream in the HttpContext</p>
  
  <p>Any help greatly appreciated!</p>
  
  <p>This how I make my request from client code:</p>
  
  <pre><code>private void Post(byte[] bytes)
      {
          HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://localhost:2977/Upload");
          req.Method = "POST";
          req.ContentType = "application/x-www-form-urlencoded";
          req.SendChunked = true;
          req.Timeout = 400000;
          req.ContentLength = bytes.Length;
          req.KeepAlive = true;
  
          using (Stream s = req.GetRequestStream())
          {
              s.Write(bytes, 0, bytes.Length);
              s.Close();
          }
  
          HttpWebResponse res = (HttpWebResponse)req.GetResponse();
      }
  </code></pre>
  
  <p>this is how I handle the request in the HttpHandler:</p>
  
  <pre><code>public void ProcessRequest(HttpContext context)
      {
          Stream chunk = context.Request.InputStream; //it's empty!
          FileStream output = new FileStream("C:\\Temp\\myTempFile.tmp", FileMode.Append);
  
          //simple method to append each chunk to the temp file
          CopyStream(chunk, output);
      }
  </code></pre>