Guest User

Untitled

a guest
Nov 23rd, 2024
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. Title: Blazor Server: NavigationException after login despite RendererInfo.IsInteractive check
  2.  
  3. Post:
  4.  
  5. I'm running into a persistent NavigationException in my Blazor Server app when trying to navigate after logging in. Here’s what happens:
  6.  
  7. I’m using SignInManager.PasswordSignInAsync for authentication, and on success, I attempt a redirect using NavigationManager.NavigateTo("Home", forceLoad: true).
  8. Before calling NavigateTo, I added a debug check for RendererInfo.IsInteractive and confirmed it returns false at that point.
  9. Despite this, the app throws the following error:
  10. typescript
  11. Copy code
  12. Microsoft.AspNetCore.Components.NavigationException: Exception of type 'Microsoft.AspNetCore.Components.NavigationException' was thrown.
  13. at Microsoft.AspNetCore.Components.Server.Circuits.RemoteNavigationManager.NavigateToCore(String uri, NavigationOptions options)
  14. at Microsoft.AspNetCore.Components.NavigationManager.NavigateToCore(String uri, Boolean forceLoad)
  15. at Microsoft.AspNetCore.Components.NavigationManager.NavigateTo(String uri, Boolean forceLoad, Boolean replace)
  16. The exception points to the redirect method in my custom IdentityRedirectManager, and the call happens after the login method (PasswordSignInAsync) completes.
  17. What I've Tried:
  18.  
  19. Ensured RendererInfo.IsInteractive is checked before navigation.
  20. Validated that the login process completes successfully.
  21. Verified HttpContext.Request.Method and HttpContext.Response.HasStarted logic to avoid any interference.
  22. 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