Skip to content

NavigationManager.NavigateTo ignores base URI #25204

@MV10

Description

@MV10

I'm altering a large Blazor server-side app which was originally developed under IIS Express (with localhost etc) to support deployment to an IIS virtual directory. Parts of the app have data-driven navigation where pages are referenced just as they're declared in the @page directives (e.g. /mycontent). We've specified the virtual directory in startup with UsePathBase so we were surprised when calls like this ignore the base:

NavManager.NavigateTo("/mycontent", forceLoad: true);

Instead of https://site.com/virtualdir/mycontent it navigates to https://site.com/mycontent which 404s.

It's easily fixed, but is this intentional, or is this a bug?

(Edit: Probably worth noting that ToAbsoluteUri also ignores the base.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✔️ Resolution: AnsweredResolved because the question asked by the original author has been answered.Status: Resolvedarea-blazorIncludes: Blazor, Razor Components

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions