title: WebClient from Asp.net gives "An existing connection was forcibly closed by the remote host" Error
body: <p>I am trying to post to our asterisk box to parse out the phone list</p>
  
  <p>from a console application this works :</p>
  
  <pre><code> class Program
    {
      static void Main(string[] args)
      {
  
  
          Console.WriteLine( HttpPost());
          System.Threading.Thread.Sleep(10000);
      }
  
      public static string HttpPost()
      {
          var URI = @"http://sip.ligmarine.com/admin/config.php?quietmode=on&amp;type=tool&amp;display=printextensions";
          var Parameters = "display=printextensions&amp;quietmode=on&amp;type=tool&amp;core=core&amp;featurecodeadmin=featurecodeadmin&amp;paging=paging";
          var retVal = "";
          WebClient wc = new WebClient();
  
          wc.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes("maint:password")));
          wc.Headers.Add("referer", @"http://sip.ligmarine.com/admin/config.php?type=tool&amp;display=printextensions");
          wc.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
  
          retVal = Convert.ToBase64String(Encoding.ASCII.GetBytes("maint:password"));
          //Console.Write("Resulting Request Headers: ");
          //Console.WriteLine(wc.Headers.ToString());
          byte[] byteArray = Encoding.ASCII.GetBytes(Parameters);
          //Console.WriteLine("Uploading to {0} ...", URI);
          // Upload the input string using the HTTP 1.0 POST method.
          byte[] responseArray = wc.UploadData(URI, "POST", byteArray);
         // Console.WriteLine("\nResponse received was {0}", );
  
          retVal = Encoding.ASCII.GetString(responseArray);
  
          return retVal;
      }
  }
  </code></pre>
  
  <p>from our IIS6 Hosted ASP.NET page I get</p>
  
  <p>An existing connection was forcibly closed by the remote host
     Description: An unhandled exception occurred during the execution of the current web<br>
     request. Please review the stack trace for more information about the error and<br>
     where it originated in the code.</p>
  
  <pre><code> Exception Details: System.Net.Sockets.SocketException: An existing connection was      forcibly closed by the remote host
  
   Source Error:
  
   Line 37:         //Console.WriteLine("Uploading to {0} ...", URI);
   Line 38:         // Upload the input string using the HTTP 1.0 POST method.
   Line 39:         byte[] responseArray = wc.UploadData(URI, "POST", byteArray);
   Line 40:         // Console.WriteLine("\nResponse received was {0}", );
   Line 41: 
  </code></pre>
  
  <p>The HttpPost Method is exactly Identical  the page load : </p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
  
      var ret = HttpPost();
      Response.Write(ret);
  }
  </code></pre>