According to the docs, NavigationManager.NavigateTo should treat relative URIs as relative to the base URI, which it how it works with existing Blazor Server and Blazor WebAssembly apps. But with SSR, it seems to navigate relative to the current address instead.
Repro steps:
- Create a Blazor Web App
- Update Index.razor with the following:
@page "/"
@page "/foo"
@page "/foo/bar"
@inject NavigationManager NavigationManager
<PageTitle>Index</PageTitle>
<h1>Hello, world!</h1>
Welcome to your new app.
@code {
protected override void OnInitialized()
{
NavigationManager.NavigateTo("weather");
}
}
Expected result: Request is redirected to /weather
Actual result: Request is redirected to /foo/weather
According to the docs,
NavigationManager.NavigateToshould treat relative URIs as relative to the base URI, which it how it works with existing Blazor Server and Blazor WebAssembly apps. But with SSR, it seems to navigate relative to the current address instead.Repro steps:
Expected result: Request is redirected to /weather
Actual result: Request is redirected to /foo/weather