Question: I have asp.net web app, how to check the current logged in user (client) is in specific Active directory group.
Thanks

Answer: 
Try this the following method. Just change it according to your needs...

```
public List<string> GetGroupNames(string userName)
{
    var pc = new PrincipalContext(ContextType.Domain);
    var src = UserPrincipal.FindByIdentity(pc, userName).GetGroups(pc);
    var result = new List<string>();
    src.ToList().ForEach(sr => result.Add(sr.SamAccountName));
    return result;
}

```
Try this (Only works in ASP.NET but similar calls are available for windows apps)

```
    if (HttpContext.Current.User.IsInRole("RoleName"))
    {
        return true;
    }
    else
    {
        return false;
    }

```

Hope this helps  

Harvey Sather