My website (with Windows authentificatication) in Intranet uses some DLL that checks current user permissions in Active Directory. It uses method GetAuthorizationGroups and works pefectly. The DLL was compiled about 10 years ago in VS 2005. Now I need to do some changes in its code (not connected to Active Directory). I opened the source code in VS 2012, framework 3.5 ,compiled it and copied to the server of the web site. Now an user that does not belong to Administrators group of this server gets error: While trying to retrieve the authorization groups, an error (5) occurred There is no error with old version of DLL or when an user is administrator. Below is the code I use:
PrincipalContext ctx = new PrincipalContext(ContextType.Domain, domainName,adusername, adpassword);
UserPrincipal user = UserPrincipal.FindByIdentity(ctx, userID);
PrincipalSearchResult groups = user.GetAuthorizationGroups();
The server works under Windows Server 2012. Any help would be appreciated.
Aucun commentaire:
Enregistrer un commentaire