Blazor Static SSR - redirect after form submission
I woudl like to redirect user after successful login. However, after
NavigationManager.NavigateTo
, it throws an exception. I tried to find any useful information, but I found nothing.
Here's my HTML form:
C# code:
4 Replies
What's the exception?
Microsoft.AspNetCore.Components.NavigationException: Exception of type 'Microsoft.AspNetCore.Components.NavigationException' was thrown.
All right, the fix for this solution is remove NavigationManager from try...catch, because it navigates with help of exception, according to this comment on GitHub: https://github.com/dotnet/aspnetcore/issues/53996#issuecomment-1971734784
GitHub
.NET 8 Blazor - NavigationManager.NavigateTo() Inconsistent Behavio...
Is there an existing issue for this? I have searched the existing issues Describe the bug A very common use case in web applications is that the user may need to navigate to another Url. Usually th...
I've faced this thing, my solution was to add
before catch-all branch
Navigation exception is not a real exception and its annoying
Or, to write less code, change your catch-all to
@hunterlan