Unable to add global AuthorizeFilter when using scaffolded Identity pages in ASP.Net Core MVC application

Solution 1:

Global AuthorizeFilter apply on every methods of your project that means your login method too.

I guess your login page is the page where users are redirected to when they are not logged in. so what happen is :

I'm going to login page => login page needs authorization => redirect to login page => login page needs authorization => redirect to login page...

Your login method has to accept anonymous connection cause user is not logged in yet.

Add the attribute [AllowAnonymous] on your login method.