Live Chat Icon For mobile
Live Chat Icon

How do I read static or local files in Blazor WebAssembly?

Platform: Blazor| Category : General, Web API

You can read static or local files by creating HttpClient Get calls. The GetStringAsync method sends a request to the specific URI and returns the response body as a string in an async operation.

@inject HttpClient Http

@code {

    protected override async Task OnInitializedAsync()
        var content = await Http.GetStringAsync(request Uri);


Please refer to “HttpClient Class” for more details.

Share with

Share on twitter
Share on facebook
Share on linkedin

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.