Karl
Karl

Reputation: 189

User.IsInRole only works with AD Group SID (rather than Group Name)

If I only use Windows Authorization, I can easily use User.IsInRole("Web Developers") without issue. But, when I add a SQL Role Provider, User.IsInRole will only return true (for Active Directory groups) if I use the group's SID.

It doesn't seem like that's the intended behavior. I've seen that querying by SID is better performance-wise, but programming using machine-readable SIDs seems suboptimal when human-readable names are available.

My workaround has been to write a method that does a SID lookup by name, and pass that to User.IsInRole (driving down performance), which I'd like to avoid.

Can anyone suggest a solution, or point me in the right direction?

Upvotes: 3

Views: 403

Answers (0)

Related Questions