469,628 Members | 1,119 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,628 developers. It's quick & easy.

Problem with Role Base Security (IsInRole)

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);
}
Nov 15 '05 #1
0 1196

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Chris | last post: by
2 posts views Thread by Jesper Stocholm | last post: by
1 post views Thread by Mike Logan | last post: by
4 posts views Thread by Jeff B | last post: by
2 posts views Thread by Dave | last post: by
8 posts views Thread by Mark White | last post: by
2 posts views Thread by Khafancoder | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.