Change identity login URL in ASP.net core 3.0

Calvin Bootsman

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.

Rena

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"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Change default identity Login route to something custom asp.net core

ASP NET CORE Identity and Checktoken URL

ASP.Net Core Identity login status lost after deploy

Register and Login by Phone Number in Asp.net Core Identity

ASP.NET Core MVC Identity login issue

link to login does not work, in ASP.NET Core Identity UI

External Login without using identity asp.net core 2.0

use existing login table with asp.net core identity service

Infinite login redirect loop with Google and ASP.NET Core Identity

How to change user login credentials in identity asp.net mvc?

Token based login logic change in ASP.NET Identity 2.0

Asp.net core identity change username/email

Change routing in ASP.NET Core Identity UI?

asp.net core mvc change default Identity area routes

Asp.net core Identity successful login redirecting back to login page

Using Asp.Net Core Identity in MVC, Authorize attribute is rebouncing to login page after succesfull login

Users Roles Permissions using ASP.NET Core Identity 3

Creating a custom SignInManager in Asp.Net Core 3 Identity

asp.net core 3 identity generatePasswordResetTokenAsync causes internal error

ASP .NET Core Identity SignInManager

Adding Redirection immediately after Login in ASP.Net Core 2.1 using Identity Core

Set the login url in ASP.Net MVC Core 2.0

change identity routing in asp.net core 3.1 from Identity/Account/Register to /Register

How to change asp net core 3 API default startup controller (/ launch URL)

.NET Core Identity Login Page handler OnGetAync()

Pass user detail after Login Is successful From identity asp.net core 3.1

Adding [Authorize] to controller failing to redirect to Identity Login route. ASP.NET CORE 3.1 MVC

How do I get the user details straight after login using Identity on ASP.NET Core?

API Integration Test for Login controller using Identity server4 in asp.net core