Answers for "check if app have administrator rights c#"

C#
0

check if app have administrator rights c#

using System.Security.Principal;

bool isElevated;
using (WindowsIdentity identity = WindowsIdentity.GetCurrent())
{
    WindowsPrincipal principal = new WindowsPrincipal(identity);
    isElevated = principal.IsInRole(WindowsBuiltInRole.Administrator);
}
Posted by: Guest on April-20-2022

C# Answers by Framework

Browse Popular Code Answers by Language