Solved

Getting user's NT User Group Name

Posted on 2006-11-27
2
188 Views
Last Modified: 2010-04-16
Hi,

I'm trying to retrieve the NT user group that the user running my application belongs to. I've been retrieving the domain name and user name using the code below and I was wondering is there some similar way of getting the user's NT user group:

//Get the domain of the current user
string domainname = System.Environment.UserDomainName;

//Get the user name
string username = System.Environment.UserName;

Any help would be appreciated,

Thanks
0
Comment
Question by:GlobexCorp
2 Comments
 
LVL 1

Accepted Solution

by:
surferxyz2 earned 500 total points
ID: 18018975
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).


See this.
http://www.csharphelp.com/archives2/archive440.html
0
 
LVL 2

Author Comment

by:GlobexCorp
ID: 18038356
Found my solution. Thanks for the suggestion anyway.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now