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
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top