I am working on simple login signup in ASP.NET core application. I am using SignInManager class for user to get signin.
When user tries to login the following function will get executed:
When the user enters correct credentials it will redirect to index action in home controller. I have added Authorize attribute for privacy action in home controller:
My question is if I enter correct credentials it is redirecting me to index action in home controller as expected. But if I try to access privacy action in home controller the Authorize attribute is redirecting me to login action in Account controller even if I successfully logged in. What is causing the problem here?



Please check and make sure you call
app.UseAuthentication()andapp.UseAuthorization()in correct order shown as below.