Blazor read directory

asp.net-core blazor

Question

How to read content directrory intro Blazor.

Path.Combine(Directory.GetCurrentDirectory(), "..", "_posts");

But in result I dont have content.

Uncaught (in promise) Error: System.IO.DirectoryNotFoundException: Could not find a part of the path '/_posts'.

Popular Answer

Clientside Blazor is running in the same sandbox that javascript is running in. Which means your code has no way of accessing the local filesystem.

Maybe localStorage could be an alternative for you? There is a Blazor package to use it here: BlazorExtensions/Storage




Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why