System.Security.AccessControl.FileSecurity Class

Represents the access control and audit security for a file. This class cannot be inherited.

See Also: FileSecurity Members


public sealed class FileSecurity : FileSystemSecurity


The System.Security.AccessControl.FileSecurity class specifies the access rights for a system file and how access attempts are audited. This class represents access and audit rights as a set of rules. Each access rule is represented by a System.Security.AccessControl.FileSystemAccessRule object, while each audit rule is represented by a System.Security.AccessControl.FileSystemAuditRule object.

The System.Security.AccessControl.FileSecurity class is an abstraction of the underlying Microsoft Windows file security system. In this system, each file has a discretionary access control list (DACL), which controls access to the file, and a system access control list (SACL), which specifies the access control attempts that are audited. The System.Security.AccessControl.FileSystemAccessRule and System.Security.AccessControl.FileSystemAuditRule classes are abstractions of the access control entries (ACEs) that comprise DACLs and SACLs.

The System.Security.AccessControl.FileSecurity class hides many of the details of DACLs and SACLs; you do not have to worry about ACE ordering or null DACLS.

Use the System.Security.AccessControl.FileSecurity class to retrieve, add, or change the access rules that represent the DACL and SACL of a file.

To persist new or changed access or audit rules to a file, use the System.IO.FileInfo.SetAccessControl(FileSecurity) method. To retrieve access or audit rules from an existing file, use the System.IO.FileInfo.GetAccessControl method.


Namespace: System.Security.AccessControl
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions:,
Since: .NET 2.0