title: Error while paypal integration
body: <p>I have tried to integrate <code>paypal sandbox</code> with my project in asp.net.</p>
  
  <p>Redirection to paypal sandbox working extremely fine ! You can check out your cart ! You can make payment ! But the problem is when paypal set redirection to my Success.aspx page !</p>
  
  <p>I got the error as </p>
  
  <pre><code>A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 192.168.0.101:808
  </code></pre>
  
  <p>I am using stream writer Object ! </p>
  
  <p>Wait Let me post my code !</p>
  
  <p>this is page_load even of Success.aspx</p>
  
  <pre><code>   protected void Page_Load(object sender, EventArgs e)
          {
              if (!Page.IsPostBack)
              {
                  // Used parts from https://www.paypaltech.com/PDTGen/
                  // Visit above URL to auto-generate PDT script
  
                  authToken = WebConfigurationManager.AppSettings["PDTToken"];
  
                  //read in txn token from querystring
                  txToken = Request.QueryString.Get("tx");
  
  
                  query = string.Format("cmd=_notify-synch&amp;tx={0}&amp;at={1}", txToken, authToken);
  
                  // Create the request back
                  string url = WebConfigurationManager.AppSettings["PayPalSubmitUrl"];
                  HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
  
                  // Set values for the request back
                  req.Method = "POST";
                  req.ContentType = "application/x-www-form-urlencoded";
                  req.ContentLength = query.Length;
  
                  // Write the request back IPN strings
                  StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
                  stOut.Write(query);
                  stOut.Close();
  
                  // Do the request to PayPal and get the response
                  StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
                  strResponse = stIn.ReadToEnd();
                  stIn.Close();
  
                  // sanity check
                  Label2.Text = strResponse;
  
                  // If response was SUCCESS, parse response string and output details
                  if (strResponse.StartsWith("SUCCESS"))
                  {
                      PDTHolder pdt = PDTHolder.Parse(strResponse);
                      Label1.Text = string.Format("Thank you {0} {1} [{2}] for your payment of {3} {4}!",
                          pdt.PayerFirstName, pdt.PayerLastName, pdt.PayerEmail, pdt.GrossTotal, pdt.Currency);
                  }
                  else
                  {
                      Label1.Text = "Oooops, something went wrong...";
                  }
              }
          }
  </code></pre>
  
  <p>This sentence creates error !!</p>
  
  <pre><code>StreamWriter stOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);
  </code></pre>
  
  <p>These type of exception occurs</p>
  
  <pre><code>    Exception Details: System.Net.Sockets.SocketException:
   A connection attempt failed because the connected party did
   not properly respond after a period of time, 
  or established connection failed because connected
   host has failed to respond 192.168.0.101:808
  </code></pre>