title: send xml file to handler using http-post
body: <pre><code>    protected void UploadFile(object sender, EventArgs e)
      {
          if (fileUpload.HasFile)
          {
              if (fileUpload.PostedFile.ContentType == "text/xml")
              {
                  Stream inputstream = fileUpload.PostedFile.InputStream;
  
                  byte[] streamAsBytes = (ConvertStreamToByteArray(inputstream));
  
                  string stringToSend = BitConverter.ToString(streamAsBytes);
  
                  xmlstream.Value = stringToSend;
  
                  sendXML.Visible = true;
                  infoLabel.Text = string.Empty;
  /*
                  string path = Server.MapPath("GenericHandler.ashx");
                  WebClient wc = new WebClient();
                  wc.UploadFile(path,"POST", fileUpload.PostedFile);
                   Something like this maybe? But is there any way to do it without saving the file?            */
  
              }
              else
              {
                  infoLabel.Text = "Please select an XML file";
                  sendXML.Visible = false;
              }
          }
      }
  </code></pre>
  
  <p>This is my current code. The xml gets saved in a hidden field as a hex string and sent via jquery ajax. But it would be much better to send the file itself and process it in the handler. Is that possible?</p>