Hi Amra, firstly, I didn't reproduce your issue in my side without complete code (lacking of views), but I noticed that you are having your custom login page even though you already have builder.Services.AddDefaultIdentity
in your application. The AddDefailtIdentity
method provide us with a simplified way to add identity services to your application which is using cookie based authentication, but you have builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme) .AddCookie
at the same time.
By the way, in asp.net core we could use AddDefaultIdentity, AddIdentity and AddIdentityCore for identification, we can see from the source code, AddDefaultIdentity
uses AddIdentityCore
, and
AddIdentity
provides more control and customization, including custom user types, roles, and more detailed configuration of identity options, but have both AddDefaultIdentity
and AddIdentity
at the same time.
Per my understanding, you might try to follow this document to add Asp.net Core identity into your MVC app. You can do it by creating a new MVC application and selecting the Authentication type to be Individual Account.
Then you will use the default identity mechanism, if you want to manage the login page, you can use scaffold tool(right click on the project name in VS and choose Add -> New scaffolded item...) to load the cshtml files into your project.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Tiny Wang