I'm trying to change the default login URL from:
/Identity/Account/Login
to
/Login
I've looked up similar questions and they came up with a solution similar to this:
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<CompanyLoginContext>(options =>
options.UseNpgsql(
Configuration.GetConnectionString("DefaultConnection")));
services.AddIdentity<CompanyLoginUser, IdentityRole>(options => options.SignIn.RequireConfirmedAccount = true)
.AddEntityFrameworkStores<CompanyLoginContext>()
.AddDefaultTokenProviders();
services.ConfigureApplicationCookie(options =>
{
options.Cookie.HttpOnly = true;
options.ExpireTimeSpan = TimeSpan.FromMinutes(10);
options.LoginPath = new PathString("/Login");
options.AccessDeniedPath = new PathString("/Logout");
options.AccessDeniedPath = new PathString("/AccessDenied");
options.SlidingExpiration = true;
});
}
But somehow this isn't working.
Be sure that you have scalffolded Identity,you could refer to here.
Then you need to modify Identity/Account/Login.cshtml
like below:
@page "/Login"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With