Which code segment should you use?

You are changing the security settings of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use?

You are changing the security settings of a file named MyData.xml. You need to preserve the existing inherited access rules. You also need to prevent the access rules from inheriting changes in the future. Which code segment should you use?

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

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

C.
FileSecurity security = File.GetAccessControl(“mydata.xml”);
security.SetAccessRuleProtection(true, true);

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



Leave a Reply 0

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