Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Title: Blazor Server: NavigationException after login despite RendererInfo.IsInteractive check
- Post:
- I'm running into a persistent NavigationException in my Blazor Server app when trying to navigate after logging in. Here’s what happens:
- I’m using SignInManager.PasswordSignInAsync for authentication, and on success, I attempt a redirect using NavigationManager.NavigateTo("Home", forceLoad: true).
- Before calling NavigateTo, I added a debug check for RendererInfo.IsInteractive and confirmed it returns false at that point.
- Despite this, the app throws the following error:
- typescript
- Copy code
- Microsoft.AspNetCore.Components.NavigationException: Exception of type 'Microsoft.AspNetCore.Components.NavigationException' was thrown.
- at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.NavigateToCore(String uri, NavigationOptions options)
- at Microsoft.AspNetCore.Components.NavigationManager.NavigateToCore(String uri, Boolean forceLoad)
- at Microsoft.AspNetCore.Components.NavigationManager.NavigateTo(String uri, Boolean forceLoad, Boolean replace)
- The exception points to the redirect method in my custom IdentityRedirectManager, and the call happens after the login method (PasswordSignInAsync) completes.
- What I've Tried:
- Ensured RendererInfo.IsInteractive is checked before navigation.
- Validated that the login process completes successfully.
- Verified HttpContext.Request.Method and HttpContext.Response.HasStarted logic to avoid any interference.
- Has anyone encountered this issue or have ideas on debugging NavigationException in a Blazor Server environment? Any insight would be appreciated!
Advertisement
Add Comment
Please, Sign In to add comment