title: Send XML via WebClient Post using MemoryStream
body: <p>I am trying to send an XML file that I created in my memorystream. The problem comes in when I try to use <code>UploadFile</code> and get the error of Invalid Arguments. My question is, is there anyway I can use my memorystream that I created with <code>WebClient.UploadFile</code> to send the file or do I need to do this some other way?</p>
  
  <pre><code>string firstname = Request.Headers["firstname"].ToString();
  string lastname = Request.Headers["lastname"].ToString();
  string organization = Request.Headers["organization"].ToString();
  string phone = Request.Headers["phone"].ToString();
  
  XmlWriterSettings settings = new XmlWriterSettings();
  settings.Indent = true;
  MemoryStream ms = new MemoryStream();
  using (XmlWriter xml = XmlWriter.Create(ms, settings))
  {
      xml.WriteStartDocument();
      xml.WriteStartElement("List");
      xml.WriteWhitespace("\n");
  
      xml.WriteStartElement("Employee");
      {
          xml.WriteElementString("First", firstname);
          xml.WriteElementString("Last", lastname);
          xml.WriteWhitespace("\n");
          xml.WriteElementString("Organization", organization);
          xml.WriteElementString("Phone", phone);
      }
  
      xml.WriteEndElement();
      xml.WriteEndDocument();
  }
  
  WebClient client = new WebClient();
  
  client.UploadFile("http://test.com/test.aspx", ms);
  </code></pre>