Assembly: mscorlib (in mscorlib.dll)
The directorySecurity parameter is a null reference (Nothing in Visual Basic).
The file could not be found or modified.
The current process does not have access to open the file.
The current operating system is not Microsoft Windows 2000 or later.
An access control list (ACL) describes individuals and/or groups who have, or do not have, rights to specific actions on the given file or directory. For more information, see ACL Technology Overview and How to: Add or Remove Access Control List Entries.
The method applies ACL entries to a file that represents the noninherited ACL list.
The ACL specified for directorySecurity replaces the existing ACL for the directory. To add permissions for a new user, use the GetAccessControl method to obtain the existing ACL, and modify it.
The method persists only DirectorySecurity objects that have been modified after object creation. If a DirectorySecurity object has not been modified, it will not be persisted to a file. Therefore, it is not possible to retrieve a DirectorySecurity object from one file and reapply the same object to another file.
To copy ACL information from one file to another:
Create a new DirectorySecurity object for the destination file.
Set the destination DirectorySecurity object to the destination file using the method.
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.