Here's my use case. I have a singleton object that is holding global site state. I have a button on my website that when clicked fires an event on the global site state object. I have a Blazor component(razor) that is listening for this event. It responds to the event by doing this
var path = "siteupdate".AddInitialQueryStringArg("returnUrl", _navManager.Uri);
_navManager.NavigateTo(path,true);
The idea is that all online users are redirected to a Razor page(.cshtml) that has a message saying "The Website is being updated, come back later". This is a requirement to provide a decent user experience for when the server goes down temporarily for an update and loses connection to the SignalR hub.
Following the execution it appears as if the navigator tries to navigate to the siteupdate page but it ends up getting rejected and resets back to whatever component I was on when I make the call. Similar to when you try to update the url in the browser manually and the navmanager resets it. Putting breakpoints in my Razor Page I can tell that the OnGet method gets called most of the time, but it seems like it's response is not being acknowledge or something? I've tried the following :
Attempted to set window location via javascript
var path = "/update".AddInitialQueryStringArg("returnUrl", _navManager.Uri);
JSRuntime.InvokeVoidAsync("BlazorHelpers.RedirectTo", path);
Attempted to not use force reload, this results in a 404
var path = "/siteupdate".AddInitialQueryStringArg("returnUrl", _navManager.Uri);
_navManager.NavigateTo(path);
For reference I have the Razor page under
Pages/SiteUpdate/UpdateLandingPage.cshtml
I tried placing it just under the Pages folder, but like I said earlier the OnGet method is getting called so the router seems to be finding it, but it seems like the framework is overwriting the URL somehow.
Thanks