Problems with the "Autorize" tag in asp.net core 2.1

0

I have been using ASP.NET Core 2.1 and when accessing as an unauthenticated user I have decided to use the [Authorize] tag in the controller, the tag works perfectly, however, when performing the redirection, access the following url:

https://localhost:44346/Account/AccessDenied?ReturnUrl=%2FPosts%2FDelete%2F2 

while the correct address should be

https://localhost:44346/Identity/Account/AccessDenied?ReturnUrl=%2FPosts%2FDelete%2F2.
    
asked by Miguel Caraballo De La Rosa 09.07.2018 в 00:10
source

1 answer

1

in Startup.cs copy the following lines within the method ConfigureServices()

services.ConfigureApplicationCookie(options =>
            {
                options.LoginPath = $"/Identity/Account/Login";
                options.LogoutPath = $"/Identity/Account/Logout";
                options.AccessDeniedPath = $"/Identity/Account/AccessDenied";
            });
    
answered by 16.11.2018 / 16:19
source