Soenneker.Blazor.Utils.Navigation 4.0.1167

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Soenneker.Blazor.Utils.Navigation --version 4.0.1167
                    
NuGet\Install-Package Soenneker.Blazor.Utils.Navigation -Version 4.0.1167
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Blazor.Utils.Navigation" Version="4.0.1167" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Utils.Navigation" Version="4.0.1167" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Blazor.Utils.Navigation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Blazor.Utils.Navigation --version 4.0.1167
                    
#r "nuget: Soenneker.Blazor.Utils.Navigation, 4.0.1167"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Blazor.Utils.Navigation@4.0.1167
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Blazor.Utils.Navigation&version=4.0.1167
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Utils.Navigation&version=4.0.1167
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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
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.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed

Update dependency Soenneker.Extensions.String to 4.0.728 (#1813)