We have some new options available to us in .NET 2.0 to discover a user’s group membership. I ran into an entry on Dominick’s blog about expanding group membership using the new IdentityReference class. This technique assumes you can get a WindowsIdentity for the user you wish to expand. I previously covered two other techniques here and here.
I use yet another 3rd technique similar to this in the book that actually takes the ‘tokenGroups’ attribute for any user in AD and expands the membership using the IdentityReference. It is the most elegant of the 3 methods, IMO.
One note on Dominick’s code: a way to further optimize this is to use .Translate on the IdentityReferenceCollection so that the call is batched under the hood.
Comments [5] September 20, 2005 Trackback
This is the personal site of Ryan Dunn, co-author of the The .NET Developers Guide to Directory Services Programming.
Ryan currently works for Microsoft and is the Technical Evangelist for SQL Server Data Services (SSDS)
Buy the Book
Contact Ryan