Skip to content

Inherit from AuthenticationStateProvider or CslaAuthenticationStateProvide #4016

Discussion options

You must be logged in to vote

This is a known issue: dotnet/aspnetcore#53996

Using an extension method HttpContext.RedirectTo(...), with [CascadingParameter] public HttpContext? HttpContext { get; set; } and adding method="post" Enhance to the EditForm is a workaround.

public static class BlazorSsrRedirectManagerExtensions
{
    public static void RedirectTo(this HttpContext httpContext, string redirectionUrl)
    {
        ArgumentNullException.ThrowIfNull(httpContext);

        httpContext.Response.Headers.Append("blazor-enhanced-nav-redirect-location", redirectionUrl);
        httpContext.Response.StatusCode = 200;
    }
}

Replies: 2 comments 14 replies

Comment options

You must be logged in to vote
12 replies
@rockfordlhotka
Comment options

@ecaldentey
Comment options

@rockfordlhotka
Comment options

@ecaldentey
Comment options

@rockfordlhotka
Comment options

Comment options

You must be logged in to vote
2 replies
@rockfordlhotka
Comment options

@michaelcsikos
Comment options

Answer selected by rockfordlhotka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants