Getting user group for a user

  • Thread starter Thread starter Sabin Finateanu
  • Start date Start date
S

Sabin Finateanu

Hi! Can anyone tell me how can I get the user group for the current windows
user? Please help me!

Sabin Finateanu
 
Hi Sabin,

You can check the user against known Windows group names by using
WindowsPrincipal's IsInRole method. Retrieving unknown group names
(which sounds like the case here) may pose more of a problem for you. If
you're on a Win2K network you may have access to Active Directory
services, and you could then take advantage of the functionality offered
by the System.Directory namespace. Without Active Directory I believe
your answer becomes more elusive (maybe others can offer potential
solutions in this case).

Good luck!

- Mike
 
Sabin,
as mike stated, checking this out without AD is different. for AD searches
and queries you use the DirectorySearcher class (under the DirectoryServices
namespace) using the LDAP protocol. for non-AD queries, use the same calss
with the WinNT protocol.

for a quick start, look for the DirectoryEntry.Path Property on the MSDN
help.

Picho
 
Back
Top