Show / Hide Table of Contents

Interface IUriHelper

Helpers for working with URIs and navigation state.

Namespace: Microsoft.AspNetCore.Blazor.Services
Assembly: Microsoft.AspNetCore.Blazor.dll
Syntax
public interface IUriHelper

Methods

GetAbsoluteUri()

Gets the current absolute URI.

Declaration
string GetAbsoluteUri()
Returns
Type Description
System.String

The current absolute URI.

GetBaseUri()

Gets the base URI (with trailing slash) that can be prepended before relative URI paths to produce an absolute URI. Typically this corresponds to the 'href' attribute on the document's <base> element.

Declaration
string GetBaseUri()
Returns
Type Description
System.String

The URI prefix, which has a trailing slash.

NavigateTo(String)

Navigates to the specified URI.

Declaration
void NavigateTo(string uri)
Parameters
Type Name Description
System.String uri

The destination URI. This can be absolute, or relative to the base URI (as returned by GetBaseUri()).

ToAbsoluteUri(String)

Converts a relative URI into an absolute one (by resolving it relative to the current absolute URI).

Declaration
Uri ToAbsoluteUri(string href)
Parameters
Type Name Description
System.String href

The relative URI.

Returns
Type Description
System.Uri

The absolute URI.

ToBaseRelativePath(String, String)

Given a base URI (e.g., one previously returned by GetBaseUri()), converts an absolute URI into one relative to the base URI prefix.

Declaration
string ToBaseRelativePath(string baseUri, string locationAbsolute)
Parameters
Type Name Description
System.String baseUri

The base URI prefix (e.g., previously returned by GetBaseUri()).

System.String locationAbsolute

An absolute URI that is within the space of the base URI.

Returns
Type Description
System.String

A relative URI path.

Events

OnLocationChanged

An event that fires when the navigation location has changed.

Declaration
event EventHandler<string> OnLocationChanged
Event Type
Type Description
System.EventHandler<System.String>
Back to top Generated by DocFX