Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

Issue redirecting with NavigationManager in OnInitialized method for Blazor app

$
0
0

I have a page with an OnInitialized() method. In that method, I set some cookies and get information from the database include a route to redirect to. I then try to use the NavigationManager's NavigateTo() method to navigate to that URL, but Visual Studio throws an error with not much info.

    Message "Exception of type 'Microsoft.AspNetCore.Components.NavigationException' was thrown."   string

Visual Studio allows me to continue and the app will redirect, if it is not the same as the current URL, but my Login component is not updated. I have to refresh the page manually to see the page as it should be.

This behavior seems odd. Why do I get the exception? And why is the other component not refreshed after changing locations?


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>