Identity Razor Pages are the ready-made account screens supplied by Microsoft.AspNetCore.Identity.UI. They turn ASP.NET Core Identity’s user-management services into a usable registration and sign-in flow without requiring you to write every page yourself. The default UI contains more than 30 Razor Pages, including pages for login, registration, account management, two-factor authentication, and external login providers. Start with these pages, then replace only the ones your application needs to change. section 23.2 section 23.5
The pages live in the Identity area. A project can use the packaged pages without showing their files in its own Pages folder. To override one, put a corresponding page under Areas/Identity/Pages. A _ViewStart.cshtml file in that folder can point the Identity pages at the application’s shared layout, so account screens look like the rest of the site. section 23.3.2 section 23.4.3
For an existing Razor Pages application that uses EF Core, connect the UI in manageable steps:
- Reference Microsoft.AspNetCore.Identity.EntityFrameworkCore and Microsoft.AspNetCore.Identity.UI, then restore the packages. section 23.4.1
- Register Identity with AddDefaultIdentity<TUser>() and connect it to the existing DbContext with AddEntityFrameworkStores<TContext>(). section 23.4.1
- Derive the DbContext from IdentityDbContext<TUser>, create a migration, and apply the database changes needed for Identity. section 23.4.2
- Set the Identity pages’ layout and add a login partial to the application layout for registration, sign-in, and signed-in account links. section 23.4.3
What a new user sees
A visitor opens Register, enters an email and password, and is sent to a confirmation screen. They can then use Login and, once signed in, reach pages for changing their email or password, configuring an authenticator app, or deleting personal data. Configure an email-sending service before relying on email confirmation: none is enabled by default. External providers also need configuration, and MFA QR-code generation is not supplied for you. section 23.3.4 section 23.4.3
Customize a page when its wording or appearance does not suit your users. For example, scaffold Register.cshtml and remove its developer-facing explanation of external login providers. Visual Studio or the .NET CLI can generate the page in the override location, with its Razor template and PageModel ready to edit. Leave the other packaged pages in place; scaffolding the whole UI creates more code to maintain. section 23.5
