Getting Group Membership

D

Dominick Baier

you have to query roles in the DOMAIN\GroupName format...



---
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

nntp://news.microsoft.com/microsoft.public.dotnet.framework.aspnet.security/<[email protected]>

Hi,

I'm trying to do something that I think should be pretty easy, take the user who is authenticated with the application (intranet application/ integrated windows authentication), and determine if they are in "this group".

Before, I had queried active directory, got the list of groups for the user and compared, but then I realized that the IsInRole Function may actually work in this case. I tried it and it doesn't seem to be working correctly. Here is what I've tried so far.

I'm impersonating in my application, so I tried this....didn't work
Dim blah As WindowsPrincipal = New WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent())
If blah.IsInRole("Domain Admins") = True Then
'is a domain admin
End If

Then I tried this:
If HttpContext.Current.User.IsInRole("Domain Admins") = True Then
'is a domain admin
End If

Still didn't return true (I am a member of this group too!) Am I missing something here, or so I just go back to querying active directory myself for group membership?

Thanks for any help!
--Michael

[microsoft.public.dotnet.framework.aspnet.security]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top