When creating a new Blazor Web Assembly solution from Visual Studio 2019 Preview (keep ASP.NET Core hosted unchecked), we have the possibility to perform a GetFromJsonAsync directly from a file located inside the wwwroot.
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("sample-data/weather.json");
}
When creating a new Blazor Web Assembly solution from Visual Studio 2019 Preview (with ASP.NET Core hosted checked), we have the possibility to perform a GetFromJsonAsync by calling an action from our
controller WeatherForecastController.
protected override async Task OnInitializedAsync()
{
forecasts = await Http.GetFromJsonAsync<WeatherForecast[]>("WeatherForecast");
}
My question is: and what if in this second scenario (ASP.NET Core hosted) I would like to get data from a file located inside my wwwroot ? Is this not possible ? Security concern ?
Thanks.