Thank you! Now roles are working as expected.
Hi EngincanV, I've got one more question. Is your code snippet working on server or client side? Because I don't have problem using it on back-end side of code (it works exacly as you sugest) . I've got problem using it on front-end, inside blazor component. Can you check that for me?
Dear EngincanV, thank you for your answer but this code snippet wont work.
If my current user is in two roles "Role1" and "Role2" currentUser.Roles will return string[] that contains one record with stringified '["Role1","Role2"]' so I will have to split or deserialize that string to check if user is in "Role1".
Furthermore, if user is just in one role currentUser.Roles will retrurn "RoleName" as simple string record so your code wont work again becasue it will compare "Role1" with '["Role1","Role2"]' .
I could solve this problem with few checks like is there '[' in record but it feels like hacking framework.
Can you check your answer one more time?