I need a bit of advice.
I’m extending a web app to integrate with AD member roles, and not too sure whether i can rely on User.IsInRole to have the member role information. Initial tests show me it does, but what is the difference between using this, and writing a class to return the user roles with DirectorySearcher/AccountManagement for example?
Is one solution better than the other?
It looks to me as though it achieves the same thing in this case. Am i right?
Thanks.
If you use active directory authorization
Users.IsInRolechecks if the user is member of the given group. It is not exactly the same as checking the groups that the user belongs to, because that only gives the direct memberships.Users.IsInRolealso checks nested group membership. An example:UserAis a member ofGroupAGroupAis a member ofGroupBNow if you check the direct memberships of
UserAyou will only getGroupA. ButUsers.IsInRolewill indicate thatUserAis a member ofGroupBthanks to the nesting.