title: How to read files from a directory in Blazor WebAssembly
body: <p>I'm currently working on a .NET Standard 2.1 Blazor WebAssembly application. I try to <strong>read file paths from my wwwroot directory</strong>.</p>
  <p>The Blazor WebAssembly App is NOT Asp.NET Core hosted.</p>
  <p><a href="https://i.stack.imgur.com/PpmHb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PpmHb.png" alt="enter image description here" /></a></p>
  <p>I try to read all file paths with the ending .js from my <code>Main</code> method in the <code>Program.cs</code> like this:</p>
  <pre><code>var filePaths = ReadWwwRootJSFilePaths();
  private static string[] ReadWwwRootJSFilePaths()
          {
              Console.WriteLine(&quot;CurrentDirectory: &quot; + Directory.GetCurrentDirectory());
              var dir = Path.Combine(Directory.GetCurrentDirectory(), &quot;wwwroot&quot;, &quot;js&quot;);
              Console.WriteLine(&quot;dir: &quot; + dir);
              var files = Directory.GetFiles(dir);
              foreach (string file in files)
              {
                  Console.WriteLine(&quot;file: &quot; + file);
              }
              return files;
          }
  </code></pre>
  <p>When I run this I only get an error message in my browser: <code>System.IO.DirectoryNotFoundException</code></p>
  <p><a href="https://i.stack.imgur.com/csKfr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/csKfr.png" alt="enter image description here" /></a></p>
  <p>Do you know how to solve this problem? Do you know how to read file paths from the <code>wwwroot</code> dir in a Blazor WASm (not ASP.NET Core hosted) application?</p>
  <p>Perhaps yet I don't quite get the concept of Blazor WebAssembly (not ASP.NET Core hosted). Is it actually possible to use C# .NET Core functionalities?</p>