Search code examples
blazorasp.net-core-identityblazor-server-side

How do I customize ASP.NET Core Identity in Server-Side Blazor?


For normal MVC-style websites, I get a set of pre-generated pages for ASP.NET Core Identity that I can customize. With it I can do things like ask for the user's age on the registration page.

What is the equivalent for server-side Blazor?


Solution

  • The difference you see is not directly related to Blazor but is present in all AspNetCore > 2.x projects.
    The GUI is inside a set of 'canned' Razor pages inside a package.

    When you have used the right starter template you should already see an Areas folder with a few files in it.

    Right-click your project, choose Add, New Scaffolded Item, Identity.

    The selected Razor pages are now extracted to your project and you can alter them. You will also need an ApplicationUser : IdentityUser {} but that should be familiar.


    You may need to fix a few things after applying the scaffolding. See https://stackoverflow.com/a/57663817/60761