spacedeveloper
Programmer
Hi All,
I'd really appreciate some help on this. It's got me a bit stumped.
I am trying to retrieve all of the Groups that I am a member of from Active Directory. The follow to pieces of code are ways that I am attempting to do this. It works very well with other users...but not for me! It used to!
Another thing is that when I do go into AD to check what groups I am a "Member Of"...I, indeed, DO belong to the very Group I am querying.
Method 1:
Method 2:
Any help would be very much appreciate.
Thank you
I'd really appreciate some help on this. It's got me a bit stumped.
I am trying to retrieve all of the Groups that I am a member of from Active Directory. The follow to pieces of code are ways that I am attempting to do this. It works very well with other users...but not for me! It used to!
Another thing is that when I do go into AD to check what groups I am a "Member Of"...I, indeed, DO belong to the very Group I am querying.
Method 1:
Code:
System.Security.Principal.WindowsPrincipal principal = new System.Security.Principal.WindowsPrincipal(System.Web.HttpContext.Current.Request.LogonUserIdentity);
bool b = principal.IsInRole("SFRevenueAudit Access");
Method 2:
Code:
ArrayList groups = new ArrayList();
foreach (System.Security.Principal.IdentityReference group in HttpContext.Current.Request.LogonUserIdentity.Groups)
{
groups.Add(group.Translate(typeof(System.Security.Principal.NTAccount)).ToString());
}
...then code to iterate through the Groups to find the one I am looking for...
Any help would be very much appreciate.
Thank you