H. Eberhardt
H. Eberhardt

Reputation: 79

How to properly Redirect To Page in Blazor server side?

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!

Upvotes: 1

Views: 2430

Answers (1)

Rena
Rena

Reputation: 36575

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");
    }
}

Upvotes: 1

Related Questions