title: check to see if URL is a download link using webclient c#
body: <p>I am reading from the history database, and for every URL read, I am downloading it and storing the data into a string. I want to be able to determine if the link is a download link, i.e. .exe or .zip for e.g. I am assuming I need to read the headers to determine this, but I don't know how to do it with WebClient. Any suggestions?</p>
  
  <pre><code>while (sqlite_datareader.Read())
  {
      noIndex = false;
  
      string url = (string)sqlite_datareader["url"];
  
      try
      {
          if (url.Contains("http") &amp;&amp; (!url.Contains(".pdf")) &amp;&amp; (!url.Contains(".jpg")) &amp;&amp; (!url.Contains("https")) &amp;&amp; !isInBlackList(url))
          {
  
              WebClient client = new WebClient(); 
              client.Headers.Add("user-agent", "Only a test!");
  
  
              String htmlCode = client.DownloadString(url);
          }
      }
  }
  </code></pre>