Redirect after form POST Blazor Static
Am I not able to have a statically rendered Blazor
@code
block return a redirect? e.g.:
7 Replies
I get NavigationManager errors if I try to use NavigationManager. My understanding is that might make sense because that's supposed to be used client side / with JavaScript.
I don't see a redirect there... but NavigationManager should be how you do it either way, as far as I know
I get the error
by adding:
under
await DbContext.SaveChangesAsync();
is this blazor client?
It's a statically rendered page
I'm looking to get Razor Pages like functionality for forms
No idea then, assumedly the blazor stuff registers that NavigationManager and it may not be registered for you
or something it needs isn't setup right, etc, since that doesn't look like a registration error
if i change the rendering mode, it works. but it will only work with javascript enabled (essentially becoming a SPA)
i assumed i could have the browser receive a redirect response from the post request like a normal page
cant seem to use methods like
RedirectToPage
in a @code { }
block or blazor code behind file
@D.Mentia figured it out 😎 . The NavigateTo
method throws if the page is statically rendered. this exception is meant to get caught by the framework to handle the redirect
my current code catches the error and does nothing with it. moving it outside of the try/catch works