问题描述
wwwroot / assets
该文件名为 zip.csv
private const string fileName = "zip.csv";
private const string filePath = "/assets/";
按照我的方法,
var strLines = File.ReadLines(filePath + fileName);
我崩溃了(请在下面登录)
blazor.webassembly.js:1 System.IO.DirectoryNotFoundException: Could not find a part of the path "/assets/zip.csv".
我可以导航到http:// localhost:5000 / assets / zip.csv并下载文件
解决方法
Client Blazor与javascript在同一沙箱中运行。要与用户的文件系统进行交互,请使用HTML标准访问文件系统,例如与此Blazor wrapper一起来。
也许localStorage足够了?选中此Blazor package以使用它