title: WebResponse dynamically 'sometimes' crash
body: <p>I have a <strong>foreach</strong> with an <strong>"If"</strong> and when the condition is true, I do a WebResponse to post my item in a server.</p>
  
  <p>Sometimes the code run for two o more items but other times crashes with the following error:</p>
  
  <p>The remote server returned an error: (407) Proxy Authentication Required.</p>
  
  <p>The code:</p>
  
  <pre><code>WebClient client = new WebClient();
  
                  string authInfo = "admin:geoserver";
                  string address = "http://xxxxxxxx:8080/geoserver/rest/workspaces/";
                  client.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(authInfo));
  
  
  
                  WebRequest request = WebRequest.Create(address);
  
                  request.ContentType = "text/xml";
                  request.Method = "POST";
  
                  request.Headers["Authorization"] = "Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(authInfo));
  
                  byte[] bret = Encoding.GetEncoding("UTF-8").GetBytes("&lt;workspace&gt;&lt;name&gt;" + nameWS + "&lt;/name&gt;&lt;/workspace&gt;");
  
  
  
                  Stream reqstr = request.GetRequestStream();
                  reqstr.Write(bret, 0, bret.Length);
                  reqstr.Close();
  
  
                  try
                  {
                      WebResponse response = request.GetResponse();
  
                      response.Close();
  
                  }
  </code></pre>
  
  <p>My Environment is C# Visual Studio 2010</p>