title: Check if a file exists on the server
body: <p>I am trying to check if a file is on the server with the C# code behind of my ASP.NET web page. I know the file does exist as I put it on the server in a piece of code before hand. Can anyone see why it is not finding the file. This is the code:</p>
  
  <pre><code>wordDocName = "~/specifications/" + Convert.ToInt32(ViewState["projectSelected"]) + ".doc";
  ViewState["wordDocName"] = wordDocName;
  if (File.Exists(wordDocName))
  {
      btnDownloadWordDoc.Visible = true;
  }
  else
  {
      btnDownloadWordDoc.Visible = false;
  }
  </code></pre>