title: Reading server-side files using Blazor
body: <p>I have a project based on the Blazor sample with a <code>.Client</code>, <code>.Server</code> and <code>.Shared</code> projects. I have a textfile <code>data.txt</code> on the server that I want to be able to read/write using standard <code>StreamReader</code> / <code>System.IO.File</code> methods. Since Blazor runs in a sandbox I guess I can't access the entire filesystem as I would in a normal windows app? I've placed the file in the <code>wwwroot</code> directory, and I can even access the file from the client if a enter <code>url/data.txt</code> in the browser so the file gets served, which I don't want to alow, but trying to read that file as such:</p>
  
  <pre><code>var file = File.ReadAllText("data.txt");
  </code></pre>
  
  <p>Results in the error:</p>
  
  <pre><code>WASM: [System.IO.FileNotFoundException] Could not find file "/data.txt"
  </code></pre>
  
  <p>How can I read server-side files and keep them hidden from the client?</p>