I have the following setup in my project:
/Pages/Page1.razor
/Pages/Page2.cshtml
Page 1 is a Blazor component.
Page 2 is a Razor Page.
At the top of Page1:
@page "/Page1"
In the Page2.cshtml.cs code-behind I have:
public IActionResult OnPostAddNew()
{
return RedirectToPage("Page1");
}
I have tried everything I can think of but I always get:
InvalidOperationException: No page named 'Page1' matches the supplied values.
I appreciate that Page1 is not technically a page but I haven't been able to figure out how to redirect. A NavLink works just fine to find Page1.