1
從Windows服務中檢索用戶所屬組的列表的最佳方式是什麼?從Windows服務獲取用戶所屬組的列表
List<string> groups = new List<string>();
foreach (IdentityReference ir in new WindowsIdentity(name).Groups)
{
SecurityIdentifier sid = new SecurityIdentifier(ir.Value);
NTAccount ntAccount = (NTAccount)sid.Translate(typeof(NTAccount));
groups.Add(ntAccount.ToString());
}
我試圖使用上面的代碼,但它引發了以下錯誤。
Error communicating with client: System.Security.SecurityException: Incorrect function.
我不知道這是如何幫助我的情況。 – Anatoli 2010-07-23 18:36:51
我想通了...謝謝... – Anatoli 2010-07-23 19:59:23