This topic is locked

Should Security.getUserGroups() work for AD groups?

4/29/2019 10:42:44 AM
ASPRunner.NET General questions
Pete K author

I tried to use the following code, adapted from the Security API section of the help file:


groups = Security.getUserGroups();

if( groups["dmhs_admins"] )

{

XSession.Session["IsAdmin"] = true;

}

else

{

XSession.Session["IsAdmin"] = false;

}


It doesn't seem to be working for me. The compiler complains:

error CS0103: The name 'groups' does not exist in the current context


I'm using AD groups.

jadachDevClub member 4/29/2019

What event are you adding this to?

Pete K author 4/29/2019



What event are you adding this to?


I'm using the After successful login event. One would think an API function would work anywhere.
I actually worked around it by using:


string groups = XSession.Session["GroupID"];

if( groups.Contains("dmhs_admins") )

{etc.}


[size="2"]But I would like to know if the Security API is fully functional with AD and if so, what I was doing wrong. [/size]

jadachDevClub member 4/29/2019

Yes, that would be good to know. I am tempted to try your original approach with an app that does not use AD.