You need to use the WindowsPrinciple class in the System.Security.Principal
namespace.
e.g.
=====================
using System.Security.Principal;
using System.Threading;
....
....
Thread.GetDomain().SetPrincipalPolicy(PrincipalPol icy.WindowsPrincipal);
WindowsPrincipal wp = (WindowsPrincipal)Thread.CurrentPrincipal;
bool isAdmin = wp.IsInRole(WindowsBuiltInRole.Administrator);
Console.WriteLine(isAdmin);
=====================
The above code will print out "True" if the current user is an Administrator
and "False" if not;
Hope this helps!
Brian Delahunty
Ireland
http://briandela.com/blog
"Ravi" wrote:
Hi,
I'm writing a C# .NET code in which I need to first determine if the
user has administrative privlieges on that system (or if the user belongs to
the administrative group). Could anyone please tell me how I can achieve this.
Thank you
Ravi.