Hello all,
I'm unable to get the IsInRole method to work with my AD domain. There is a
global group that I am a member of, when I query that group using the
IsInRole method, it returns false.
One question that I had, is there anything different that has to be done
with AD when using this method? For example, I'm populating a list box with
the members of this group, and when I attach using LDAP I had to use
"LDAP://server.domain.com/CN=Group,DC=domain,DC=com" to attach.
I noticed that when I got the current identity, the user name was in
pre-Win2K form @"Domain\Kevin" so to determine role, I used
(IsInRole(@"Domain\Group") which does not work. Is there another form this
needs to take? Also, the group name has spaces in it, could that be part of
the problem?
I'm including a code snippet below, please let me know if anyone has any
ideas.
Thanks
Kevin
WindowsIdentity wiUserID = WindowsIdentity.GetCurrent();
WindowsPrincipal wpPrincipal = new WindowsPrincipal(wiUserID);
if(wpPrincipal.IsInRole(@"Domain\Default Title Curative"))
{
MessageBox.Show("It worked","OK",MessageBoxButtons.OK);
}
else
{
MessageBox.Show("Error","Wrong",MessageBoxButtons. OK);
}