Code Snippet:

 


using System.Net;

  /// Checks the file exists or not.
  /// The URL of the remote file.
  /// True : If the file exits, False if file not exists
  private bool CheckIfFileExists(string url)
  {
   try
   {
    //Create the HttpWebRequest and get web response and check status. If status code is HttpStatusCode.OK then return true otherwise false  
    return (((HttpWebResponse)WebRequest.Create(url).GetResponse()).StatusCode == HttpStatusCode.OK);
   }
   catch
   {
    //Any exception will returns false.
    return false;
   }
  }

.