How do I read from a server-side binary file in Blazor?


Hal Heinrich

After some user input, I want to read data from a binary file and write a response. I've put the binary file in the App_data folder like this:

Solution Explorer

I can't figure out how specify the directory where the binary file resides:

const String BODIST_DATA_FILENAME = "~/App_Data/BoDistData.dat";
using FileStream dataFs = new FileStream(BODIST_DATA_FILENAME, FileMode.Open, FileAccess.Read);

The project is a Blazor App enter image description here

Continue reading...