Skip to content

Commit 73f0e07

Browse files
committed
Fix event registration.
1 parent 21314b6 commit 73f0e07

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,13 @@ internal async Task InitializeStandardComponentServicesAsync(
7676
string? handler = null,
7777
IFormCollection? form = null)
7878
{
79-
var navigationManager = (IHostEnvironmentNavigationManager)httpContext.RequestServices.GetRequiredService<NavigationManager>();
80-
navigationManager?.Initialize(GetContextBaseUri(httpContext.Request), GetFullUri(httpContext.Request));
79+
var navigationManager = httpContext.RequestServices.GetRequiredService<NavigationManager>();
80+
((IHostEnvironmentNavigationManager)navigationManager)?.Initialize(GetContextBaseUri(httpContext.Request), GetFullUri(httpContext.Request));
8181

82-
if (navigationManager is HttpNavigationManager httpNavigationManager)
82+
navigationManager?.NotFoundEvent += (sender, args) =>
8383
{
84-
httpNavigationManager.NotFoundEvent += (sender, args) =>
85-
{
86-
SetNotFoundResponse();
87-
};
88-
}
84+
SetNotFoundResponse();
85+
};
8986

9087
var authenticationStateProvider = httpContext.RequestServices.GetService<AuthenticationStateProvider>();
9188
if (authenticationStateProvider is IHostEnvironmentAuthenticationStateProvider hostEnvironmentAuthenticationStateProvider)

0 commit comments

Comments
 (0)