-
Notifications
You must be signed in to change notification settings - Fork 10.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Router's NotFound content is never used in new Web project style #48983
Comments
@SteveSandersonMS In my view, we should remove the notfound from the template, and just return 404 letting the ASP.NET Core pipeline deal with it. There is a general feature for displaying content on 404s, and we would want Blazor to be part of that (in fact, we should see if we can plug it in there). I would avoid the fallback route as much as possible, it creates a host of problems when there are also APIs and other endpoints in the app. |
That sounds good, but do you happen to know how best to integrate it? Is this something developers can reasonably do in their own code, or do we need an item on the backlog for .NET 8 for this? Also we have to take at least some action in framework code, because |
@SteveSandersonMS I think the way to let the server handle 404's is to trigger a 404 response, return and let For errors we should do the same thing, let it bubble and have it redirect to There are two cases for 404 we need to account for.
|
Agreed. Do we want to use this issue to track this API addition? Or should we open a separate issue? |
It would be ideal to open a new issue outlining the design. For timelines, I suspect we can live without this for .NET 8 since we've been doing fine without it all this time and SSR doesn't significantly change the set of cases where you'd want this (people already asked for it in the past when prerendering). If we get time to do it that sounds great, but it won't be a blocker for people if we don't - they already address this by putting in page-specific "no such item" UI and live with returning 200s. |
Related issue: #45654 |
I have experienced something similar with authorization. |
The
<Router>
component still accepts aNotFound
fragment (and we supply it in the default template), but it won't ever be used:Error: 404
@page
routes, and so the existing client-side routing logic causes it to do a full-page loadNotFound
fragment. But since we no longer have fallback routing, you'll now see either the browser's built-in 404 UI or any custom 404 page returned by the ASP.NET Core serverI'm not saying any of these outcomes is wrong, but just that:
NotFound
parameter in the default project templateNotFound
content when there's no way it can ever be used (except if the developer manually configures a fallback route that maps all URLs to aRazorComponentResult
that renders their top-level component).We should at least consider whether it could make sense to map a fallback route automatically for this case.
The text was updated successfully, but these errors were encountered: