title: Remote server (403) Forbidden error while using WebClient
body: <p>I am trying to query some URL using <code>WebClient</code>.</p>
  
  <p>I have a collection which I loop through to get the <code>QueryString</code> value, and build final URL, and then pass it on to client.</p>
  
  <p>The very first time it gets executed well, I get proper response, however, when it goes in loop second time, I get the error:</p>
  
  <blockquote>
    <p>System.Net.WebException --> The remote server returned an error: (403) Forbidden.</p>
  </blockquote>
  
  <p>If I get response for very first time. Then I should get for rest of the collection too.</p>
  
  <p>Any clue why? What I might be missing? </p>
  
  <p>Below is the code snippet I am using.</p>
  
  <pre><code> using(System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\sample.text")) {
      foreach(var f in fileCollections) {
          strFinalURL = string.Empty;
  
          strFinalURL = "someURL" + f; // f can be considered as querystring param value
  
          try {
              using(var client = new WebClient()) {
  
                  test = client.DownloadString(strFinalURL);
                  if (!test.Contains("somecondition")) {
                      file.WriteLine("");
                  }
              }
          } catch (System.Exception ex) {
              Console.WriteLine(ex.Message);
          }
      }
  }
  </code></pre>