Demon10000
Supreme [H]ardness
- Joined
- Aug 20, 2006
- Messages
- 4,502
Good Afternoon:
I'm trying to whip up a little utility, and I'm almost done. It's a web app that is written in VB.
I'm trying to lock down some specific buttons based on group membership in Active Directory. In reading, I should be able to test a users group membership with something like:
I can't quite get that to work. It always returns false.
I've taken a peek at using another method:
roles.isuserinrole("domain\user", "domain\group") and that throws a new exception:
I'm really looking for a method to just toss a group name and check if the currently authenticated user is in the group, and it needs to work recursively (the user might not be in the group, but they might be in a group that's a member of the group I'm checking).
Can anyone point me in the right direction?
Thanks!
I'm trying to whip up a little utility, and I'm almost done. It's a web app that is written in VB.
I'm trying to lock down some specific buttons based on group membership in Active Directory. In reading, I should be able to test a users group membership with something like:
Code:
If my.user.isinrole("domain\groupname") then dosomething
I can't quite get that to work. It always returns false.
I've taken a peek at using another method:
roles.isuserinrole("domain\user", "domain\group") and that throws a new exception:
System.Configuration.Provider.ProviderException was unhandled by user code
HResult=-2146233088
Message=The Role Manager feature has not been enabled.
Source=System.Web
StackTrace:
at System.Web.Security.Roles.EnsureEnabled()
at System.Web.Security.Roles.IsUserInRole(String username, String roleName)
at osdWeb._Default.Page_Load(Object sender, EventArgs e) in H:\Source\project\Default.aspx.vb:line 36
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:
I'm really looking for a method to just toss a group name and check if the currently authenticated user is in the group, and it needs to work recursively (the user might not be in the group, but they might be in a group that's a member of the group I'm checking).
Can anyone point me in the right direction?
Thanks!