Die Gerüstidentität erstellt keine erforderlichen Seiten für Anmeldung und RegisterC#

Ein Treffpunkt für C#-Programmierer
Anonymous
 Die Gerüstidentität erstellt keine erforderlichen Seiten für Anmeldung und Register

Post by Anonymous »

Ich versuche, die Identitäts -UI mit login.cshtml und register.cshtml für meine ASP.NET -Kernanwendung zu

Code: Select all

using ObjectCrudApp.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
using ObjectCrudApp.Areas.Identity.Data;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container
builder.Services.AddDbContext(options =>
options.UseSqlite(builder.Configuration.GetConnectionString("DefaultConnection")));

builder.Services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true).AddEntityFrameworkStores();

// Configure Identity services
builder.Services.AddIdentity(options =>
options.SignIn.RequireConfirmedAccount = false) // Customize as per your needs
.AddEntityFrameworkStores() // Use the same DbContext for both App and Identity
.AddDefaultTokenProviders();

// Configure Application Cookie for Access Denied
builder.Services.ConfigureApplicationCookie(options =>
{
options.AccessDeniedPath = "/Identity/Account/AccessDenied"; // Path to redirect when access is denied
});

// Add MVC services to the container
builder.Services.AddControllersWithViews();

var app = builder.Build();

// Configure the HTTP request pipeline
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts(); // HTTP Strict Transport Security
}

app.UseHttpsRedirection();
app.UseRouting();

app.UseAuthentication(); // Make sure authentication comes before authorization
app.UseAuthorization();

// Map the controller routes
app.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();
< /code>
Ich habe den Befehl ausgeführt: < /p>
dotnet aspnet-codegenerator identity --useDefaultUI --force
, aber nur _validationscriptScriptSpartial.cshtml und _viewStart.cshtml unter den Bereichen/Seiten erstellt, aber ich möchte alle Dateien:

Code: Select all

Login.cshtml
, Register.cshtml, AccessDenied.cshtml, ForgotPassword.cshtml, ResetPassword.cshtml
Here is the screenshot of my project directory:

Ich versuche, die Identitäts -UI mit Anmeldung und Registrierung für meine ASP.NET -Kernanwendung zu registrieren. Ich möchte, dass mein Befehl login.cshtml und registrieren.cshtml Nachdem ich den Befehl scastolding ausgeführt habe.

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post