7.3Using in Blazor WebAssembly Applications
Created on Aug 17, 2026~3 min read
HTTP remote requests support use in Blazor WebAssembly client applications. The following are the detailed steps for configuration and use:
1. Register the HttpRemote Service
In the Startup.cs or Program.cs file, register the HttpRemote service and configure FallbackBaseAddress:
builder.Services.AddHttpRemote() .ConfigureOptions((options, serviceProvider) => { var navigation = serviceProvider.GetRequiredService<NavigationManager>(); options.FallbackBaseAddress = new Uri(navigation.BaseUri); });2. Import the Namespace in _Imports.razor
In the _Imports.razor file, add the namespace for the HttpRemote service:
@using HttpAgent; // if using the Furion framework, use @using Furion.HttpRemote;3. Use It in *.razor Files
In *.razor files, inject IHttpRemoteService and send HTTP remote requests:
@page "/weather"@inject IHttpRemoteService Http// other code...@code { private WeatherForecast[] forecasts; protected override async Task OnInitializedAsync() { forecasts = await Http.GetAsAsync<WeatherForecast[]>("sample-data/weather.json"); }}Through the above steps, you can easily use the HTTP remote request feature in Blazor WebAssembly applications, dynamically fetch data, and render it to the page.