Last post Mar 05, 2012 02:15 AM by sachin.gangarde
Mar 01, 2012 02:03 AM|sachin.gangarde|LINK
I have following code to update Access control list but it is not working. Can anybody correct it?
public void compright()
DirectoryEntry user = new DirectoryEntry("LDAP://Ip Address/CN=Users,DC=domain,DC=com", "administrator","Password",AuthenticationTypes.Secure);
comp.Options.SecurityMasks = SecurityMasks.Owner | SecurityMasks.Group | SecurityMasks.Dacl | SecurityMasks.Sacl;
foreach (DirectoryEntry us in user.Children)
if (us.Name == "CN=Hacker")
ActiveDirectorySecurity ads = computer.ObjectSecurity;
NTAccount account = new NTAccount("domain\\saching");
SecurityIdentifier sid = (SecurityIdentifier)account.Translate(typeof(SecurityIdentifier));
ActiveDirectoryAccessRule rule = new ActiveDirectoryAccessRule(sid, ActiveDirectoryRights.ExtendedRight | ActiveDirectoryRights.GenericRead | ActiveDirectoryRights.GenericWrite, System.Security.AccessControl.AccessControlType.Allow);
catch (Exception e)
Response.Write("Exception in rights");
Mar 02, 2012 09:42 AM|MaxV|LINK
What is the exception you are recieving when you execute the code?
What exactly are you trying to set as the permissions? Do you need to modify the SACL information?
Mar 05, 2012 02:15 AM|sachin.gangarde|LINK
I want to modify the Accesss control list of active directory user.
I am geeting following error :
Some or all identity references could not be translated.
Can u also advice me what to mention in NTAccount.
Please advice me if I am wrong somewhere.