Solved

Getting user's NT User Group Name

Posted on 2006-11-27
2
195 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C#  Radio button search for Date not DateTime 4 46
Code works but it's slow 28 70
SSRS subreport with parameter 3 29
C# bracket error 3 30
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

775 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