How to properly Redirect To Page in Blazor server side?

Viewed 816

Simple doubt here...

in asp.net core MCV controller I could redirect to some pages using RedirectToAction("Action", "Controller") from server side.

Is there any way to do it using Blazor Server Side?

Thank you!

1 Answers

In blazor server side, you could redirect to page by using NavigationManager:

@inject NavigationManager NavManager


<p>Redirecting to Page</p>

@code {
    protected override void OnInitialized()
    {
        NavManager.NavigateTo("/fetchdata");
    }
}
Related