Description
Summary
In this article What’s new with identity in .NET 8
it is stated that:
The new version is built with Razor components and works with both server-side and WebAssembly Blazor apps.
However here In SSR, supply HttpContext as cascading value #50253 it is stated that:
In SSR, this will receive the HttpContext. In other rendering modes where there is no HTTP context, no value will be supplied so the property will remain null.
So these two statements conflict with each other, because in the new .NET8 Blazor template for example the Login.razor page needs the HttpContext:
[CascadingParameter] private HttpContext HttpContext { get; set; } = default!;
Other pages also use the RedirectManager.RedirectToCurrentPageWithStatus
method which needs HttpContext
as a parameter.
I have created a new project using this template:
And selected the Interactive render mode "Server"
And now when I start this application, I can see during debugging that the HttpContext from Cascading Parameter is not actually null:
In this template, the Program.cs has these lines:
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
Am I correct to assume that means I am using what used to be Blazor Server Side nad now Interactive Server Side Rendering? And if yes, then why in such case the HttpContext is not null?
Motivation and goals
I would like to use the new Blazor Identity UI in the application which I updated from .NET7 to .NET8
In scope
Clarification as to how can I use Identity in Blazor SS.
Do I still need _Host.cshtml to extract authentication information from HttpContext during application load?
Can I use new Identity razor components in Blazor SS-only application?
Can I access HttpContext in a Blazor SS-only application?
Is Blazor Server Side now renamed "interactive SSR" in the documentation?