What do i have to do to prevent this code from giving me namespace errors?
bool IsAnAdministrator ()
{
WindowsIdentity identity =
WindowsIdentity.GetCurrent();
WindowsPrincipal principal =
new WindowsPrincipal (identity);
return principal.IsInRole
(WindowsBuiltInRole.Administrator);
}
WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal currentPrincipal = new WindowsPrincipal(currentIdentity);
System.AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
if (currentPrincipal.IsInRole(WindowsBuiltInRole.Administrator))
{
MessageBox.Show("Is an Administrator "); }
else
{
MessageBox.Show(" Isn't Administrator ");
}