title: Reading static files in ASP.NET Blazor
body: <p>I have a client side Blazor Application. I want to have an <code>appsetting.json</code> file for my client-side configuration like we have an <code>environment.ts</code> in 
  Angular.</p>
  
  <p>For that, I am keeping a <code>ConfigFiles</code> folder under <code>wwwroot</code> and a JSON file inside of it. I am trying to read this file as below.</p>
  
  <p>First get the path:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public static class ConfigFiles
  {
      public static string GetPath(string fileName)
      {
          return Path.Combine("ConfigFiles", fileName);
      }
  }
  </code></pre>
  
  <p>Than read it:</p>
  
  <pre class="lang-cs prettyprint-override"><code>public string GetBaseUrl()
  {
      string T = string.Empty;
      try
      {
          T = File.ReadAllText(ConfigFiles.GetPath("appsettings.json"));
      }
      catch (Exception ex)
      {
          T = ex.Message;
      }
      return T;
  }
  </code></pre>
  
  <p>But I always get the error:</p>
  
  <blockquote>
    <p>Could not find a part of the path "/ConfigFiles/appsettings.json".</p>
  </blockquote>
  
  <p>Inside the <code>GetPath()</code> method, I also tried:</p>
  
  <pre class="lang-cs prettyprint-override"><code>return Path.Combine("wwwroot/ConfigFiles", fileName);
  </code></pre>
  
  <p>But I still get the same error:</p>
  
  <blockquote>
    <p>Could not find a part of the path "wwwroot/ConfigFiles/appsettings.json".</p>
  </blockquote>
  
  <p>Since there is no concept of <code>IHostingEnvironment</code>in client-side Blazor, what is the correct way to read a static JSON file here?</p>