I want to set Authorize tag in my controller and when I do so, it says that your access to that controller is denied. but in the database, everything looks good. then what is the problem? *I should mention that I use individual accounts authentication type
[Authorize(Roles = "Admin")]
public IActionResult ContactUs()
{
return View();
}
CodePudding user response:
Try to log out from your application and log in again.
CodePudding user response:
You are probably missing role services
builder.Services.AddDefaultIdentity<IdentityUser>(...)
.AddRoles<IdentityRole>()
...