AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal; WindowsIdentity identity = (WindowsIdentity)principal.Identity; FastPrincipal prin = new FastPrincipal(identity); isAdmin = prin.IsInRole(WindowsBuiltInRole.Administrator);
时间: 2024-10-21 10:41:49