title: Use c# to access and download file from web server using url
body: <p>I have two url’s as below (Dummy Examples) which I receive by email.</p>
  <p>I want to know if it’s possible to find out using the url which leads to the location of a file like a .pdf or .docx (as I know one does)  and which leads to a homepage of a website (as I know one does).</p>
  <p>If one of them does lead to a file location, i want to check the file type, if it’s a .pdf or .docx then i want to download the file.</p>
  <p>Can this be done in C#, and if so are there any examples I could follow?</p>
  <blockquote>
  <p><code>http://Test1.TestWebsite.com/dms/fd.php?campaign=441&amp;email=myemail@myDomain.com&amp;user_id=32&amp;id=97</code></p>
  <p><code>http://Test2.TestWebsite.com/dms/fwd.php?campaign=441&amp;email=myemail@myDomain.com&amp;user_id=32&amp;link=40</code></p>
  </blockquote>
  <p>Thanks</p>