System.IO.File.GetAccessControl Method

Gets a System.Security.AccessControl.FileSecurity object that encapsulates the access control list (ACL) entries for a specified file.

Syntax

public static System.Security.AccessControl.FileSecurity GetAccessControl (string path)

Parameters

path
The path to a file containing a System.Security.AccessControl.FileSecurity object that describes the file's access control list (ACL) information.

Returns

A System.Security.AccessControl.FileSecurity object that encapsulates the access control rules for the file described by the path parameter.

Remarks

Use the File.GetAccessControl(string) method to retrieve the access control list (ACL) entries for a 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.

In NTFS environments, System.Security.AccessControl.FileSystemRights.ReadAttributes and System.Security.AccessControl.FileSystemRights.ReadExtendedAttributes are granted to the user if the user has System.Security.AccessControl.FileSystemRights.ListDirectory rights on the parent folder. To deny System.Security.AccessControl.FileSystemRights.ReadAttributes and System.Security.AccessControl.FileSystemRights.ReadExtendedAttributes, deny System.Security.AccessControl.FileSystemRights.ListDirectory on the parent directory.

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0
Since: .NET 2.0