Last post Nov 15, 2018 02:26 AM by Nan Yu
Nov 14, 2018 08:05 AM|SaeedPi|LINK
Please help me!
I searched a lot in MSDN documents and other websites but didn't get any answer to my problem. So, When I use [Authorize] on top of each controller or action in ASP.Net Core 2.1 or above, individually it works but when I determine a special role (for example:
[Authorize(Roles ="Admin")] ) it never works and no one can access the controller or action!
Please tell me is that my fault or ".Net Core 2" has bug ?!
Also, I should add that I'm using Visual Studio 2017 v15.8.8 and .Net core 2.1
Nov 14, 2018 09:15 AM|PatriceSc|LINK
Never heard about this. Which kind of authentication or role provider are you using? You check other APIs such as IsInRole or maybe https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.identity.usermanager-1.getrolesasync?view=aspnetcore-2.1#Microsoft_AspNetCore_Identity_UserManager_1_GetRolesAsync__0_ to
see if you get the expected roles ?
Nov 15, 2018 02:26 AM|Nan Yu|LINK
Hi SaeedPi ,
Roles are exposed to the developer through the IsInRole method on the ClaimsPrincipal class.
Could you please provide details steps to help us reproduce your issue ?