title: Error with download a file from https using webclient
body: <p>I have create a piece of code that download a file from a given URL using WebClient.</p>
  
  <p>The problem is i am getting the following error when the code is trying to download a file from a <code>HTTPS</code> site.</p>
  
  <pre><code>The remote certificate is invalid according to the validation procedure
  </code></pre>
  
  <p>This issue happened only on the server not on the local machine, so i also don't know how to debug it.</p>
  
  <p>I have read several answers on the web but didn't find anything that could help me.</p>
  
  <p>The piece of code:</p>
  
  <pre><code> using (WebClient Client = new WebClient())
          {
              string fileName = System.Configuration.ConfigurationManager.AppSettings["siteUploadedDirectory"] 
              + "/temp/" + Context.Timestamp.Ticks.ToString() 
              + "_" + FileURL.Substring(FileURL.LastIndexOf('/')+1);
              fileName = Server.MapPath(fileName);
              Client.DownloadFile(FileURL, fileName);
              return fileName + "|" + FileURL.Substring(FileURL.LastIndexOf('/')+1);
          }
  </code></pre>
  
  <p>The URL i am trying:</p>
  
  <pre><code>http://Otakim.co.il/printreferrer.aspx?ReferrerBaseURL=cloudents.com
  &amp;ReferrerUserName=ram
  &amp;ReferrerUserToken=1
  &amp;FileURL=https://www.cloudents.com/d/lzodJqaBYHu/pD0nrbAtHSq
  </code></pre>
  
  <p>The file URL:
  FileURL=<a href="https://www.cloudents.com/d/lzodJqaBYHu/pD0nrbAtHSq" rel="nofollow">https://www.cloudents.com/d/lzodJqaBYHu/pD0nrbAtHSq</a></p>
  
  <p>Any help will be appreciated </p>