When I run my c# Windows Forms Application on Windows 7 with:
- A user in the "Users" group that is not in the Administrators group
- On a machine where User Account Control is turned off
- By right-clicking the EXE and selecting "Run as Administrator"
This code:
WindowsPrincipal pricipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
bool hasAdministrativeRight = pricipal.IsInRole(WindowsBuiltInRole.Administrator);
still returns false. Is this expected behaviour?