Applies access control list (ACL) entries described by a System.Security.AccessControl.FileSecurity object to the file described by the current System.IO.FileInfo object.
- fileSecurity
- A System.Security.AccessControl.FileSecurity object that describes an access control list (ACL) entry to apply to the current file.
The FileInfo.SetAccessControl(System.Security.AccessControl.FileSecurity) method applies access control list (ACL) entries to the current file that represents the noninherited ACL list.
Use the FileInfo.SetAccessControl(System.Security.AccessControl.FileSecurity) method whenever you need to add or remove ACL entries from a file.
The ACL specified for the fileSecurity parameter replaces the existing ACL for the file. To add permissions for a new user, use the erload:System.IO.Directory.GetAccessControl method to obtain the existing ACL, modify it, and then use FileInfo.SetAccessControl(System.Security.AccessControl.FileSecurity) to apply it back to the file.
An ACL describes individuals and/or groups who have, or do not have, rights to specific actions on the given file. For more information, see ACL Technology Overview and How to: Add or Remove an Access Control List Entry.
The FileInfo.SetAccessControl(System.Security.AccessControl.FileSecurity) method persists only System.Security.AccessControl.FileSecurity objects that have been modified after object creation. If a System.Security.AccessControl.FileSecurity object has not been modified, it will not be persisted to a file. Therefore, it is not possible to retrieve a System.Security.AccessControl.FileSecurity object from one file and reapply the same object to another file.
To copy ACL information from one file to another:
[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]