title: "The request was aborted: The request was canceled." while processing PayPal IPN
body: <p>I have the following C# ASP.Net code for processing PayPal IPN after purchase. I have set the Encoding in PayPal settings to UTF8. When I send the request back to PayPal with ASCII encoding (all the UTF8 in the code replaced to ASCII) everything works. When I send the request with UTF8 encoding, I receive "The request was aborted: The request was canceled." exception at streamOut.Close() on the last line. I'm using Godaddy Shared Hosting with IIS 7 and .Net 2 enabled. Any suggestions?</p>
  
  <pre class="lang-cs prettyprint-override"><code>protected void Page_Load(object sender, EventArgs e)
      {
  
          string strRequest = string.Empty;
          try
          {
              string strLive = "https://www.paypal.com/cgi-bin/webscr";
              HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strLive);
              req.KeepAlive = false;
              req.ReadWriteTimeout = 600000;
              req.Timeout = 600000;
  
              //Set values for the request back
              req.Method = "POST";
              req.ContentType = "application/x-www-form-urlencoded";
              byte[] param = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
              strRequest = Encoding.UTF8.GetString(param);
              strRequest += "&amp;cmd=_notify-validate";
              req.ContentLength = System.Text.Encoding.UTF8.GetByteCount(strRequest);
  
              //Send the request to PayPal and get the response
              Stream RequestStream = req.GetRequestStream();
              StreamWriter streamOut = new StreamWriter(RequestStream, System.Text.Encoding.UTF8);
              RequestStream.ReadTimeout = 600000;
              RequestStream.WriteTimeout = 600000;
              streamOut.Write(strRequest);
              streamOut.Close(); // EXCEPTION: "The request was aborted: The request was canceled."
  </code></pre>