Identity (not msidentity
) scaffolding doens't work with InteractiveServer
render mode on Blazor server
#2738
Labels
msidentity
) scaffolding doens't work with InteractiveServer
render mode on Blazor server
#2738
Ask a question
I am using the Identity scaffolding to build a Blazor server-based website.
One of my customers is so bugged with the default "complex" password requirements, stating it makes the whole thing "unusable". Instead of lowering the password standard, I proposed a solution that use a password generator built-in on the registration page.
So I added a button to generate the password, but the button never ever worked. I set a breakpoint on the
randomPassword()
method but it was never hit.This StackOverflow question pointed out that The newly introduced RenderMode settings is to blame, so I added
@rendermode InteractiveServer
on this page. Unfortunately, this didn't solve the problem, but also introduced a new one. I now have aNullReferenceException
originating from\Components\Account\Shared\StatusMessage.razor
. The HTTPContext isnull
for some reason.This is the code in question:
Then I tried to change the render mode in
App.razor
to InteractiveServer. Notice that the render mode was set tonull
when the route starts with/Account
with the scaffolding. Unfortunately, things are even worse with the page being completely unusable, refershing itself once per second and with a memory leak about 1MB per second.For your reference, this should be the template:
https://github.com/dotnet/Scaffolding/blob/main/src/Scaffolding/VS.Web.CG.Mvc/Templates/BlazorIdentity/Pages/Register.tt
To solve this problem, I could:
But the ultimate question is, why Identity doesn't with InteractiveServer render mode?
Include provider and version information
Microsoft.VisualStudio.Web.CodeGeneration.Design version: 8.0.2
Target framework: .NET 8
Operating system: Windows 11 Pro
IDE: (e.g. Visual Studio 2022 17.10.0 Preview 7.0)
The text was updated successfully, but these errors were encountered: