DirectorySecurity Constructor (String, AccessControlSections)

 

Initializes a new instance of the DirectorySecurity class from a specified directory using the specified values of the AccessControlSections enumeration.

Namespace:   System.Security.AccessControl
Assembly:  mscorlib (in mscorlib.dll)

public DirectorySecurity(
	string name,
	AccessControlSections includeSections
)

Parameters

name
Type: System.String

The location of a directory to create a DirectorySecurity object from.

includeSections
Type: System.Security.AccessControl.AccessControlSections

One of the AccessControlSections values that specifies the type of access control list (ACL) information to retrieve.

Exception Condition
ArgumentException

The name parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by InvalidPathChars.

ArgumentNullException

The name parameter is null.

DirectoryNotFoundException

The specified path is invalid, (for example, it is on an unmapped drive).

FileNotFoundException

The file specified in the name parameter was not found.

IOException

An I/O error occurred while opening the directory.

NotSupportedException

The name parameter is in an invalid format.

PlatformNotSupportedException

The current operating system is not Microsoft Windows 2000 or later.

PathTooLongException

The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters.

PrivilegeNotHeldException

The current system account does not have administrative privileges.

SystemException

The directory could not be found.

UnauthorizedAccessException

The name parameter specified a directory that is read-only.

-or-

This operation is not supported on the current platform.

-or-

The caller does not have the required permission.

This constructor retrieves the access control information for the specified directory and then creates a DirectorySecurity object that encapsulates that information. You can then inspect, add, or delete the access control information for the specified directory.

FileIOPermission

for permission to access the directory specified by the name parameter. Associated enumerations: NoAccess , View

Security action: Demand

.NET Framework
Available since 2.0
Return to top
Show: