dc

dc

  • NA
  • 663
  • 0

C# roles

Nov 1 2012 11:05 AM
I had a previous post about this topic, but I am still have a problem accessing user group from the active directory.

In a C# 2008 desktop application, I need change the application since all the users are moving from one domain to new domain. The current application does not let the user access information under the new domain name.
To accomplish this goal, I would like to see what roles have been setup for those users starting with myself.

I have tried the following items but they do not work or at least I do not know how to access the groups (roles) a user has access to:
To accomplish this goal, I would like to know how to access those roles.

1. Thread.CurrentPrincipal.Identity
2. System.Security.Principal.WindowsIdentity

Thus can you tell how I can access the groups/roles a user has access to from the items listed above?

If not, should I use the Active Directory (System.DirectoryServices.AccountManagement API)  to find details about a user and the groups he's associated with? I would have to import System.DirectoryServices into my project and I would prefer not to use this option since this would not be permanent code.

Thus can you tell me ow show me in code how to accomplish this goal?

Answers (3)