Soenneker.Blazor.Utils.Navigation
4.0.1168
Prefix Reserved
dotnet add package Soenneker.Blazor.Utils.Navigation --version 4.0.1168
NuGet\Install-Package Soenneker.Blazor.Utils.Navigation -Version 4.0.1168
<PackageReference Include="Soenneker.Blazor.Utils.Navigation" Version="4.0.1168" />
<PackageVersion Include="Soenneker.Blazor.Utils.Navigation" Version="4.0.1168" />
<PackageReference Include="Soenneker.Blazor.Utils.Navigation" />
paket add Soenneker.Blazor.Utils.Navigation --version 4.0.1168
#r "nuget: Soenneker.Blazor.Utils.Navigation, 4.0.1168"
#:package Soenneker.Blazor.Utils.Navigation@4.0.1168
#addin nuget:?package=Soenneker.Blazor.Utils.Navigation&version=4.0.1168
#tool nuget:?package=Soenneker.Blazor.Utils.Navigation&version=4.0.1168
Soenneker.Blazor.Utils.Navigation
A scoped Blazor WebAssembly navigation helper that tracks observed locations, builds encoded query strings, and wraps the built-in MSAL login/logout navigation extensions.
It complements NavigationManager; it does not replace Blazor routing or the browser History API.
Installation
dotnet add package Soenneker.Blazor.Utils.Navigation
using Soenneker.Blazor.Utils.Navigation.Registrars;
builder.Services.AddNavigationUtilAsScoped();
The service starts tracking locations when it is first resolved. Resolve it immediately after building a WebAssembly host if navigation can occur before the first component injects it:
WebAssemblyHost host = builder.Build();
host.Services.WarmupNavigation();
await host.RunAsync();
@using Soenneker.Blazor.Utils.Navigation.Abstract
@inject INavigationUtil Navigation
Navigate and add query parameters
Navigation.NavigateTo("/orders");
Navigation.NavigateTo("/orders", forceLoad: true);
forceLoad: false uses normal Blazor navigation when possible. forceLoad: true asks the browser to load the destination document.
Query names and values are encoded by QueryHelpers:
Navigation.NavigateTo("/search", new Dictionary<string, string>
{
["q"] = "red shoes",
["sort"] = "newest"
});
NavigateTo accepts relative or absolute destinations just like NavigationManager. If a destination can be influenced by a user, validate it before navigating; otherwise it can become an open redirect to an external origin.
Navigate to the previously observed location
if (Navigation.CanNavigateBack)
Navigation.NavigateBack();
The utility records NavigationManager.LocationChanged events in memory and navigates to the prior recorded URI. This is not window.history.back() and does not inspect the browser’s history stack.
Browser back/forward actions are themselves recorded as new observations. For example, after the browser moves from C back to B, the utility’s previous observed location can be C. Use the browser History API directly when exact browser-stack semantics are required.
History exists only for the current service instance, is capped to recent entries, and is lost on a full page load.
Reload and current URI
Uri current = Navigation.GetCurrentUri();
Navigation.Reload(forceLoad: true);
Use forceLoad: true for an actual document reload. With false, navigating to the current URI follows NavigationManager SPA behavior and may be a no-op.
MSAL sign-in
Navigation.Login("authentication/login", new MsalLoginOptions
{
ReturnUrl = "/account",
Scopes = ["api://example/orders.read"],
Prompt = SignInPrompt.SelectAccount,
ExtraParameters = new Dictionary<string, string>
{
["domain_hint"] = "example.com"
}
});
Convenience account-picker flow:
Navigation.LoginSelectAccount(
returnUrl: "/account",
scopes: ["api://example/orders.read"]);
Supported prompt values are Default, SelectAccount, Login, Consent, and None. Default omits the prompt parameter. The explicit options request identity-provider behavior but do not guarantee it; providers can apply their own policy.
The login path and return URL must remain within the application base URI. Extra parameters cannot override the selected prompt. Keep paths, scopes, and protocol parameters under application control rather than copying arbitrary URL input into them.
Sign out
Navigation.Logout(
logoutPath: "authentication/logout",
returnUrl: "/signed-out");
The logout path and return URL are also restricted to the application base URI. Server-side identity and API authorization remain authoritative; client navigation helpers do not enforce authentication or access control.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Components.WebAssembly.Authentication (>= 10.0.11)
- Microsoft.AspNetCore.WebUtilities (>= 10.0.11)
- Soenneker.Extensions.String (>= 4.0.729)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Blazor.Utils.Navigation:
| Package | Downloads |
|---|---|
|
Soenneker.Blazor.Utils.Session
A Blazor utility for access-token caching and optional idle-timeout navigation |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1168 | 0 | 8/30/2026 |
| 4.0.1167 | 0 | 8/30/2026 |
| 4.0.1166 | 0 | 8/30/2026 |
| 4.0.1165 | 0 | 8/30/2026 |
| 4.0.1164 | 19 | 8/29/2026 |
| 4.0.1163 | 26 | 8/29/2026 |
| 4.0.1162 | 50 | 8/29/2026 |
| 4.0.1161 | 283 | 8/26/2026 |
| 4.0.1160 | 253 | 8/25/2026 |
| 4.0.1159 | 439 | 8/21/2026 |
| 4.0.1158 | 667 | 8/18/2026 |
| 4.0.1157 | 90 | 8/18/2026 |
| 4.0.1156 | 562 | 8/12/2026 |
| 4.0.1155 | 100 | 8/12/2026 |
| 4.0.1154 | 104 | 8/11/2026 |
| 4.0.1153 | 672 | 8/8/2026 |
| 4.0.1152 | 417 | 8/7/2026 |
| 4.0.1151 | 380 | 7/29/2026 |
| 4.0.1150 | 327 | 7/28/2026 |
| 4.0.1149 | 278 | 7/28/2026 |
Update dependency Soenneker.Extensions.String to 4.0.729 (#1814)