2

I want to create a System.Security.Principal.NTAccount object in order to transfer it for a System.Security.Principal.SecurityIdentifier , so I can use it to add a new access rule to Active Directory in .Net C#

if I use this format :

  System.Security.Principal.IdentityReference newOwner new System.Security.Principal.NTAccount("DUDUG");
  newOwner.Translate(typeof(System.Security.Principal.SecurityIdentifier);

I can transfer it, but then the user translates to "Unknown User" in AD

and if I use:

System.Security.Principal.IdentityReference newOwnernew System.Security.Principal.NTAccount("dudu.test.com","DUDUG")

or

System.Security.Principal.IdentityReference newOwnernew System.Security.Principal.NTAccount("//dudu.test.com/temp","DUDUG")

or

System.Security.Principal.IdentityReference newOwnernew System.Security.Principal.NTAccount("LDAP://dudu.test.com/CN=Dudu,OU=TEST,DN=DUDU,DN=TEST,DN=COM","DUDUG")

i get the error message:

System.Security.Principal.IdentityNotMappedException: Some or all identity references could not be translated.

Any ideas of how it's done?

Thanks in advance.

Falko
  • 17,076
  • 13
  • 60
  • 105
David Gidony
  • 1,243
  • 3
  • 16
  • 31

0 Answers0