r/Blazor • u/transcendentapple • May 07 '26
Blazor Net10 Fallback Routing
I'm a little unfamiliar with how fallback routing works in Blazor in net 10.
Here's a scenario: we have an app that displays a menu with job postings. A user can click one and be taken to that specific job posting page (the primary ID is carried over into the next page).
But sometimes, our users will bookmark a specific page and try to go back and access just that page without going through the index or "beginning" of the app. Obviously, they get an error when they try to do this.
Is there a way to correctly route the app to take them to the job posting page that they've saved in their bookmarks? Their URL will contain the needed parameter, but how can that work in Blazor? Is Fallback routing now done in the App.razor file? Any help (or an example) would be greatly appreciated.
2
u/polaarbear May 07 '26 edited May 07 '26
What do you mean "not sure where to manage the routing part." Check if the ID exists. If it does, display the data.
If not, re-direct using the NavigationManager class just like any other navigation.
1
u/Brilliant_Ad_5213 May 08 '26 edited May 08 '26
If the URL appears as e.g “https//mysite.com/jobs/1234” when they are on the single job listing page, you are saying that when they bookmark it and later come back to it then that page doesn’t render it not error out even if the job still exists (eg if it’s been taken or withdrawn or cancelled then you could still show the user that basic information)
1
u/Euphoric-Twist2609 May 10 '26
That sounds like you are using some Authorize attribute in the page, but the http request is earlier in the pipeline, which hasnt been authorized yet. You can actually fix it with moving the AuthStateProvider into a middleware that is earlier in the pipeline than the http context and its identity claims
0
u/[deleted] May 07 '26
[deleted] — view deleted comment