title: Error while attempting to simulating an http post containing XML on localhost
body: <p>I'm sure this is simple, but I'm missing the forest for the trees...</p>
  
  <p>I need to simulate an HTTP Post to my localhost so I can test some response and request routines to ensure that I'm receiving and sending the XML required correctly. After some research, I thought it would be a good idea to use WebClient.UploadString to accomplish this.</p>
  
  <p>Basically, I need to send an HTTP Post in which the InputStream contains an XML document.</p>
  
  <p>The method code I'm using is:</p>
  
  <pre><code>public static void SendPunchOutSetupRequestTest()
    {
      string xml = File.ReadAllText(
                  @"C:\blah\blah\blah\Sample XML\PunchoutSetupRequest.xml");
  
      string url = new UriBuilder("http", "localhost", 2020,"Account\\CCLaunch").ToString();
  
      using (WebClient client = new WebClient())
        {
            client.UploadString(url, xml);
        }
   }
  </code></pre>
  
  <p>When I hit the client.UploadString() portion, I'm getting the error:
  "Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host."</p>
  
  <p>I'm not exactly sure what is happening or why. I should mention that I'm running the method above within the same web app that I'm trying to debug (the post is going to localhost:2020/Account/someView). Is the problem the fact that I'm calling a page (using client) from within the same application that the page exists?</p>
  
  <p>If I'm NOT going about this correctly, can anyone make any suggestions as to how I can send an HTTP Post to Localhost where the inputstream contains a static (for now) XML?</p>