Using MapFallbackToPage with a page called Index.cshtml leads to an ambiguious match
See original GitHub issueRepro
- Create a new Server-Side Blazor app.
- Rename
Pages/_Host.cshtml
->Pages/Index.cshtml
. - Navigate to
/Index
in the app.
This results in an ambiguous match from routing because a page named Index
produces two endpoints. This isn’t ideal because it can be a useful pattern to place a page in the app route and then use fallback routing.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:15 (6 by maintainers)
Top Results From Across the Web
Why do I get this AmbiguousMatchException?
The ambiguous exception occurs because there are two routes that match the endpoint for /Index .
Read more >Routing in ASP.NET Core
NET Core routing is responsible for matching HTTP requests and dispatching to ... as the best match, an ambiguous match exception is thrown....
Read more >ASP.NET Core Blazor routing and navigation
This article explains how to manage Blazor app request routing and how to use the NavLink component to create navigation links.
Read more >Routing in Razor Pages
cshtml to the root pages folder and attempt to browse to it, an exception will be raised: AmbiguousActionException: Multiple actions matched.
Read more >Pro ASP.NET Core 6
Using MVC, Blazor, and Razor Pages ... every occurrence of a trademarked name, logo, or image we use the names, logos, ... Using...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Well… I think I just ran into it this. Been pulling my hair out trying to figure out how I was getting 2 endpoints for a fallback to a razor page to serve a simple spa.
If / is requested it doesn’t reach the fallback and is served… however… any request expected to be handled by the client hits the fallback and the following error is generated:
We ran into this as well. We can alleviate the problem by using
@page "/"
onIndex.cshtml
. But it’s a lot of head-scratching.