Skip to content

Commit 74e3eae

Browse files
committed
Fix "response started" scenarios.
1 parent 6876252 commit 74e3eae

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Components/Endpoints/src/Rendering/EndpointHtmlRenderer.EventDispatch.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ private void SetNotFoundResponse(object? sender, EventArgs args)
7979
if (_httpContext.Response.HasStarted)
8080
{
8181
// We cannot set a NotFound code after the response has already started
82+
var navigationManager = _httpContext.RequestServices.GetRequiredService<NavigationManager>();
83+
navigationManager?.NavigateTo("/not-found");
8284
return;
8385
}
8486
_httpContext.Response.StatusCode = StatusCodes.Status404NotFound;

0 commit comments

Comments
 (0)