G
Guest
Hi!
Can anyone please explain me why following code gives an SecurityException
"System.Security.SecurityException: The name provided is not a properly
formed account name."?
-- code start --
System.Security.Principal.NTAccount ntAccount = new
System.Security.Principal.NTAccount(@"<domain>\Administrators");
System.Security.Principal.SecurityIdentifier sid =
(System.Security.Principal.SecurityIdentifier)ntAccount.Translate(typeof(System.Security.Principal.SecurityIdentifier));
-- code end --
where "<domain>" in "<domain>\Administrators" is your Active Directory Domain.
Note:
<domain>\Administrators is a built-In group. It is visible trough 'Find'
dialog in Active Directory Users and Computers Snap-In.
Can anyone please explain me why following code gives an SecurityException
"System.Security.SecurityException: The name provided is not a properly
formed account name."?
-- code start --
System.Security.Principal.NTAccount ntAccount = new
System.Security.Principal.NTAccount(@"<domain>\Administrators");
System.Security.Principal.SecurityIdentifier sid =
(System.Security.Principal.SecurityIdentifier)ntAccount.Translate(typeof(System.Security.Principal.SecurityIdentifier));
-- code end --
where "<domain>" in "<domain>\Administrators" is your Active Directory Domain.
Note:
<domain>\Administrators is a built-In group. It is visible trough 'Find'
dialog in Active Directory Users and Computers Snap-In.