PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

C# Resolve Windows Identity Group ID To Name

 
 
Hrrglburf
Guest
Posts: n/a
 
      9th Jan 2007
WindowsIdentity wi = WindowsIdentity.GetCurrent();
Concerning 'wi.Groups'
will get me 'id'-like values such as
"S-1-5-21-141028557-4071250340-2647578567-1028"

Anyone know how I can resolve that to get the groups name? rather than
this long string identifier?

 
Reply With Quote
 
 
 
 
Michael Nemtsev
Guest
Posts: n/a
 
      10th Jan 2007
Hello Hrrglburf,

Use Translate method of the IdentityReference class

WindowsIdentity wi = WindowsIdentity.GetCurrent();

foreach (IdentityReference identRef in wi.Groups)
{
IdentityReference account = identRef.Translate(typeof (NTAccount));
Console.WriteLine(account.Value);
}

---
WBR,
Michael Nemtsev [C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


H> WindowsIdentity wi = WindowsIdentity.GetCurrent();
H> Concerning 'wi.Groups'
H> will get me 'id'-like values such as
H> "S-1-5-21-141028557-4071250340-2647578567-1028"
H> Anyone know how I can resolve that to get the groups name? rather
H> than this long string identifier?
H>


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
User SID's won't resolve, group SID's seem to resolve Rich Microsoft Windows 2000 Security 0 6th Jan 2009 08:50 PM
When I delete name from Main Identity-it also deletes from Group =?Utf-8?B?TW9kZWx0ZWU=?= Microsoft Outlook Contacts 1 16th Sep 2005 02:07 AM
user group set not login in local, why administrator also not login ? how can i resolve it redsea Microsoft Windows 2000 Security 1 22nd Jul 2005 04:00 AM
Cannot resolve text-URLs, but can resolve IP adrs Kevin F Microsoft Windows 2000 DNS 1 24th Jun 2004 03:37 AM
Difference between HttpContext.Current.User.Identity and identity Impersonation Giovanni Bassi Microsoft ASP .NET 0 20th Oct 2003 03:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:29 PM.