public bool RemoveUserToGroup(string userlogin, string groupName) { try { using (HostingEnvironment.Impersonate()) { _directoryEntry = null; ADManager admanager = new ADManager("xxx"); // LDAPUser, LDAPPassword); admanager.RemoveUserFromGroup(userlogin, groupName); return(true); } } catch (Exception ex) { return(false); } }