title: ASP.NET Core serving a file outside of the project directory
body: <p>In my ASP.NET Core project I am trying to serve an html file like this:</p>
  
  <pre><code>public IActionResult Index()
  {
      return File("c:/path/to/index.html", "text/html");
  }
  </code></pre>
  
  <p>This results in an Error:</p>
  
  <pre><code>FileNotFoundException: Could not find file: c:/path/to/index.html
  </code></pre>
  
  <p>Pasting the path from the ErrorMessage into my browser I am able to open the file, so the file is clearly there.</p>
  
  <p>The only way I have been able to serve the file is placing it in wwwroot in the project folder and serving it like this:</p>
  
  <pre><code>public IActionResult Index()
  {
      return File("index.html", "text/html");
  }
  </code></pre>
  
  <p>I have already changed the folder I serve static files from using <code>app.UseStaticFiles(options)</code> (which works), so I figured the Controller would use that folder as default, but it keeps looking in wwwroot.</p>
  
  <p>How can I serve a file that is placed outside of wwwroot, or even outside the project, from a Controller?</p>