In server-side Blazor how can I redirect to .cshtml Login page from Blazor component(.razor)?
Login.cshtml (located in the ProjectRoot/Identity/Login folder)
@page "/login"
<p> I am login page </p>
Index.razor
@page "/"
@inject NavigationManager NavigationManager
<AuthorizeView>
<NotAuthorized>
@if (true)
{
NavigationManager.NavigateTo("/login");
}
</NotAuthorized>
</AuthorizeView>
Currently, with the above code, I get an exception: Microsoft.AspNetCore.Components.NavigationException. What is the proper way of referring to the .cshtml page?