I'm using Windows Authentication and AD groups as roles. I got the following to work:
@User.IsInRole("DOMAIN\ADGroupName")
After some testing, it seems this only works with the Display Name, not the Alias of the AD group. Most groups in our domain have complex naming like:
@User.IsInRole("DOMAIN\*DEPT/TEAM/A&BC Developers")
This returns false, even if you are in a group with the same name. How can I get @User.IsInRole("")
to recognize such complex group names?