HxRedirectTo #

Rendering a HxRedirectTo will navigate to a new location.
Can be used in AuthorizeRouteView, Router and similar components to redirect to a login page, error page, or similar.

Sample usage in App.razor #

    <Router AppAssembly="@typeof(App).Assembly">
        <Found Context="routeData">
            <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">
                    @if (context.User.Identity?.IsAuthenticated != true)
                        <HxRedirectTo Uri="@($"authentication/login?returnUrl={Uri.EscapeDataString(NavigationManager.Uri)}")" />
                        <HxRedirectTo Uri="errors/NotAuthorized" />
            <FocusOnNavigate RouteData="@routeData" Selector="h1" />
            <HxRedirectTo Uri="errors/NotFound" />

Basic usage #


Parameters #

Name Type Description
ForceLoad bool If true, bypasses client-side routing and forces the browser to load the new page from the server, regardless of whether the URI would normally be handled by the client-side router.
Default is false.
Uri string URI to navigate to.
An unhandled error has occurred. Reload 🗙