I'm following along to these to guides:
After following the 1st guide I get what I expect for the Identity/Account/Manage pages:
However, after following the 2nd guide the layout is broken. The side menu is missing. The app is no longer finding Areas/Identity/Pages/Account/Manage/_Layout.cshtml
, and I don't understand why.
This is the git diff.
namespace WebIdentity.Areas.Identity
{
public class IdentityHostingStartup : IHostingStartup
{
public void Configure(IWebHostBuilder builder)
{
builder.ConfigureServices((context, services) => {
services.AddDbContext<IdentityDbContext>(options =>
options.UseSqlServer(
context.Configuration.GetConnectionString("IdentityDbContextConnection")));
- services.AddDefaultIdentity<User>(options => options.SignIn.RequireConfirmedAccount = true)
- .AddEntityFrameworkStores<IdentityDbContext>();
+ services
+ .AddIdentity<User, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
+ .AddEntityFrameworkStores<IdentityDbContext>()
+ .AddDefaultTokenProviders();
+
+ services
+ .AddMvc()
+ .AddRazorPagesOptions(options =>
+ {
+ options.Conventions.AuthorizeAreaFolder("Identity", "/Account/Manage");
+ options.Conventions.AuthorizeAreaPage("Identity", "/Account/Logout");
+ });
+
+ services.ConfigureApplicationCookie(options =>
+ {
+ options.LoginPath = $"/Identity/Account/Login";
+ options.LogoutPath = $"/Identity/Account/Logout";
+ options.AccessDeniedPath = $"/Identity/Account/AccessDenied";
+ });
+
+ services.AddSingleton<IEmailSender, EmailSender>();
});
}
}