title: HttpWebRequest Hanging
body: <p>In the application I am currently working on there is a backend java app that is caching a bunch of data. The asp.net part is allowing users to update database tables. Each time the DB is updated the cache in the java application should be cleared. So basically I have a list of 4 URLs that each need to be hit in order to clear the cache. My basic solution was to loop through each url and create a HttpWebRequest and get then get the response. So basically I have this for each request: </p>
  
  <pre><code>var request = (HttpWebRequest)WebRequest.Create(url);
                  request.Method = "POST";
                  request.ContentLength = 0;
  
                  using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                  {
                      Stream receiveStream = response.GetResponseStream();
                      StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
                      string responseString = readStream.ReadToEnd();
  
                      returnList.Add(string.Format("Refresh response from {0}.&lt;br /&gt;{1}", url, responseString));
  
                      readStream.Close();
                      receiveStream.Close();
                  }
  </code></pre>
  
  <p>On my local machine everything works great. But when I deploy to our development server it just hangs and does nothing. If I remove <code>request.ContentLength = 0;</code> then the remote server throws a 411: Length expected error. </p>
  
  <p>I am really stuck here and any help would be greatly appreciated.</p>
  
  <p>Either a solution to the HttpWebRequest problem I am having or a different solution to calling each URL would work, I'm not picky.</p>
  
  <p>Thanks in advance.</p>