Hi Mark,
Yeah there is but it is not pretty... you'll need reflection to access
private parts that Microsoft in all it's wisdom hid from us hack- (sorry)
developers.
Here's my function for it:
public static string[] GetRoles(WindowsIdentity identity)
{
WindowsPrincipal principal = new WindowsPrincipal(identity);
try
{
principal.IsInRole(WindowsBuiltInRole.User); // Ensure roles are loaded.
FieldInfo field = typeof(WindowsPrincipal).GetField("m_roles",
BindingFlags.NonPublic | BindingFlags.Instance);
return (string[])field.GetValue(principal);
}
catch (Exception err)
{
throw new Exception("Cannot determine roles.", err);
}
}
Hope this helps,
Michel
"Mark" <mf****@idonotlikespam.cce.umn.edu> wrote in message
news:e1**************@tk2msftngp13.phx.gbl...
Is there a way in Windows Authentication to list ALL the domain roles that
a user is a part of? The syntax below only allows you to check if the user
is in a single specified role ...
User.IsInRole("whatever").ToString()
Thanks in advance!
Mark