Choose the code segment which will accomplish the task.

You work as the application developer at Domain.com.
You want to modify the current security settings of a file named Certkiller Data.xml, as follows:
1. You must preserve all existing inherited access rules.
2. You must prevent the access rules from inheriting future modifications Choose the code segment which will accomplish the task.

You work as the application developer at Domain.com.
You want to modify the current security settings of a file named Certkiller Data.xml, as follows:
1. You must preserve all existing inherited access rules.
2. You must prevent the access rules from inheriting future modifications. Choose the code segment which will accomplish the task.

A.
FileSecurity security = new FileSecurity(” Certkiller data.xml”, AccessControlSections.All);
security.SetAccessRuleProtection(true, true);
File.SetAccessControl(” Certkiller data.xml”, security);

B.
FileSecurity security = new FileSecurity();
security.SetAccessRuleProtection(true, true);
File.SetAccessControl(” Certkiller data.xml”, security);

C.
FileSecurity security = File.GetAccessControl(” Certkiller data.xml”);
security.SetAccessRuleProtection(true, true);

D.
FileSecurity security = File.GetAccessControl(” Certkiller data.xml”);
security.SetAuditRuleProtection(true, true);
File.SetAccessControl(” Certkiller data.xml”, security);

Explanation:
Retrieve the full access control list for the file, prevent access rules from inheriting in the future by calling Security.SetAccessRuleProtection(). Finally call File.SetAccessControl() to apply the amended FileSecurity to the file. B does not preserve the existing access rules. It overwrites them. C does not apply the amended FileSecurity object back to the file. D FileSecurity.SetAuditRuleProtection() is used for controlling audit rules not access rules.



Leave a Reply 1

Your email address will not be published. Required fields are marked *


Ray

Ray

I think the right answer should be:

FileSecurity security = File.GetAccessControl(” Certkiller data.xml”);
security.SetAccessRuleProtection(true, true);
File.SetAccessControl(” Certkiller data.xml”, security);