How to know user rights
-
Hi, I would like to know the Administrator Rights are there are not for the current user. My application gives the computer name etc., when the user runs on his machine, at the same time I would like to know whether the user have Administrator rights or not. Can any one help me. Thanks, Sreepathi Sreepathi
-
Hi, I would like to know the Administrator Rights are there are not for the current user. My application gives the computer name etc., when the user runs on his machine, at the same time I would like to know whether the user have Administrator rights or not. Can any one help me. Thanks, Sreepathi Sreepathi
using System.Security.Principal; using System.Threading; ... ... ... WindowsPrincipal winId = (WindowsPrincipal)Thread.CurrentPrincipal; bool isAdmin = winId.IsInRole(WindowsBuiltInRole.Administrator); bool isPowerUser = winId.IsInRole(WindowsBuiltInRole.PowerUser);
-
using System.Security.Principal; using System.Threading; ... ... ... WindowsPrincipal winId = (WindowsPrincipal)Thread.CurrentPrincipal; bool isAdmin = winId.IsInRole(WindowsBuiltInRole.Administrator); bool isPowerUser = winId.IsInRole(WindowsBuiltInRole.PowerUser);