'Is it possible to get an ASP.NET Core service to listen for and react to changes to a query string?

I'm building what is essentially a directory app using Blazor WASM and .net 6. As part of this app I need to be able to filter down the data I'm returning to the user and I'm building a filter service to do this. Currently the user clicks on a filter item and this triggers a method in the filter service that updates some parameters. The component that displays the data is listening for changes to these parameters and updates when they change.

I've injected an instance of navigation manager into my filter service and upon clicking a filter item, the service also builds a new query string and navigates the user to this.

Currently, if the user bookmarks the page with the query string, upon returning to it none of the filters are set and the data therefore isn't filtered either.

What I'd like to be able to do is get the filter service to register the query string and react to it when it changes.

Is this possible?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source