Solved

Getting user's NT User Group Name

Posted on 2006-11-27
2
175 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
Comment Utility
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
Comment Utility
Found my solution. Thanks for the suggestion anyway.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

13 Experts available now in Live!

Get 1:1 Help Now