Hi, this is a snippet I once used, it shows "User" or "User, Administrator" IIRC:
List roles=new List();
try {
// on LP9300 this code produces an exception "Unable to get role for this RID"
Thread.GetDomain().SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
WindowsPrincipal wp=new WindowsPrincipal(WindowsIdentity.GetCurrent());
foreach(object roleName in Enum.GetValues(typeof(WindowsBuiltInRole)))
if (wp.IsInRole((WindowsBuiltInRole)roleName)) roles.Add(roleName.ToString());
} catch (Exception exc) {
log(exc);
}
log("Windows role = "+string.Join(", ", roles.ToArray()));
:)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.