FileSystemAclExtensions.SetAccessControl Method

Definition

Overloads

SetAccessControl(DirectoryInfo, DirectorySecurity)

Changes the security attributes of an existing directory.

SetAccessControl(FileInfo, FileSecurity)

Changes the security attributes of an existing file.

SetAccessControl(FileStream, FileSecurity)

Changes the security attributes of an existing file.

SetAccessControl(DirectoryInfo, DirectorySecurity)

Changes the security attributes of an existing directory.

public static void SetAccessControl (this System.IO.DirectoryInfo directoryInfo, System.Security.AccessControl.DirectorySecurity directorySecurity);

Parameters

directoryInfo
DirectoryInfo

An existing directory.

directorySecurity
DirectorySecurity

The security information to apply to the directory.

Exceptions

directorySecurity is null.

Applies to

.NET 9 og andre versioner
Produkt Versions
.NET Core 1.0, Core 1.1, 6, 7, 8, 9
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5

SetAccessControl(FileInfo, FileSecurity)

Changes the security attributes of an existing file.

public static void SetAccessControl (this System.IO.FileInfo fileInfo, System.Security.AccessControl.FileSecurity fileSecurity);

Parameters

fileInfo
FileInfo

An existing file.

fileSecurity
FileSecurity

The security information to apply to the file.

Exceptions

fileSecurity is null.

Applies to

.NET 9 og andre versioner
Produkt Versions
.NET Core 1.0, Core 1.1, 6, 7, 8, 9
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5

SetAccessControl(FileStream, FileSecurity)

Changes the security attributes of an existing file.

public static void SetAccessControl (this System.IO.FileStream fileStream, System.Security.AccessControl.FileSecurity fileSecurity);

Parameters

fileStream
FileStream

An existing file.

fileSecurity
FileSecurity

The security information to apply to the file.

Exceptions

fileStream or fileSecurity is null.

The file stream is closed.

Applies to

.NET 9 og andre versioner
Produkt Versions
.NET Core 1.0, Core 1.1, 6, 7, 8, 9
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5