Is there any way to check the admin privileges in C#.Net Compact Framework??
I have the source code from MSDN in C++.
and
This will check if user is in the local Administrators group (assuming you're not checking for domain admin permissions):
using System.Security.Principal;
public bool IsUserAdministrator()
{
//bool value to hold our return value
bool isAdmin;
try
{
//get the currently logged in user
WindowsIdentity user = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(user);
isAdmin = principal.IsInRole(WindowsBuiltInRole.Administrator);
}
catch (UnauthorizedAccessException ex)
{
isAdmin = false;
}
catch (Exception ex)
{
isAdmin = false;
}
return isAdmin;
}
But using System.Security.Principal;
is not available in C#.NET CF
Is it possible to implement the same in C#Net CF.