I'm trying to create a fallback route to a Razor page inside my ASP.NET Core application so I can host a server-side Blazor app on a subpath. Creating a fallback route from the root works as described in the documentation. But I want it my fallback on routes /Admin/*.
My current code looks like this:
app.UseEndpoints(endpoints =>
{
// ...
endpoints.MapFallbackToPage("/Admin", "/Admin/_Host");
});
I've also tried to use the following setup:
app.UseEndpoints(endpoints =>
{
// ...
endpoints.MapFallbackToPage("/Admin/{*segment}", "/Admin/_Host");
});
Both configurations end up generating a 404 when I enter a URL for a page that exists in my Blazor app.
I verified that navigating within the Blazor app using <NavLink> does work.
What would be the correct way of doing this?
endpoints.MapFallbackToPage; the url you're trying to hit; the@pageof your component