Blazor h2 get the current pageroute (url) in de appbar of main layout. I am building a help page to called form a standard lik within the appbar in a Blazor Web App under .net8. The idea is that for each page a helppage is displayed with text to be read from a database. The id for the text should be the pageroute defined in @page
Loading
Sophia CarterPosted Jan 15, 2025, 3:24 PM
It sounds like you are looking to dynamically retrieve the current page route (URL) in a Blazor Web App to display help text specific to that page. This can be achieved by accessing the navigation manager in Blazor to get the URI of the current page.
You can inject the NavigationManager into your component and then use it to get the current navigation location:
Once you have the current URI, you can extract the specific page route you need for fetching the corresponding help text from your database. This way, you can dynamically display relevant help content based on the user's location within your Blazor Web App.
Remember to handle any necessary parsing of the URI to extract the relevant page route if needed. This approach allows you to create a personalized and helpful user experience by providing context-specific help content within your Blazor application.
If you encounter any specific challenges or need further assistance with implementing this functionality, feel free to ask for more guidance!