How to detect if user is administrator ?

  • Thread starter Thread starter sebapi
  • Start date Start date
S

sebapi

Hello!
How to detect if logged user is administrator with using C# ??

Thanks for help.
Regards.
Sebastian.
 
sebapi said:
Hello!
How to detect if logged user is administrator with using C# ??

WindowsPrinciple wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
if (wp.IsInRole(WindowsBuiltInRole.Administrator))
{
//They're in the Administrator group
}
 
Back
Top