Explain ASP.NET Core Identity.?
ASP.NET Core Identity is a membership system that manages users, passwords, roles,
claims, and authentication.
It provides:
- User registration & login
- Password hashing
- Role & claims management
- Two-factor authentication
- Cookie & token-based authentication
Example:
You can scaffold Identity to get ready-to-use pages for login, registration, and password
reset.
Follow :
⚙ 2. How do you configure Identity in ASP.NET Core?
Add Identity services in Program.cs:
builder.Services.AddDbContext<AppDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("Defa
ultConnection")));
builder.Services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<AppDbContext>()
.AddDefaultTokenProviders();