title: "A connection attempt failed because the connected party did not properly respond after a period of time" using WebClient
body: <p>I am using the following code which is working on local machine, but when i tried the same code on server it throws me error </p>
  
  <blockquote>
    <p><em>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</em></p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>WebClient client = new WebClient();
  // Add a user agent header in case the 
  // requested URI contains a query.
  //client.Headers.Add ("ID", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
  Stream data = client.OpenRead("http://" + Request.ServerVariables["HTTP_HOST"] + Request.ApplicationPath + "/PageDetails.aspx?ModuleID=" + ID);
  StreamReader reader = new StreamReader(data);
  string s = reader.ReadToEnd();
  Console.WriteLine(s);
  data.Close();
  reader.Close();
  </code></pre>
  
  <p>I am getting error on </p>
  
  <pre><code>Stream data = client.OpenRead("http://" + Request.ServerVariables["HTTP_HOST"] + Request.ApplicationPath + "/PageDetails.aspx?ModuleID=" + ID);
  </code></pre>
  
  <p>is it due any firewall setting?</p>