System.Security.AccessControl.FileSystemSecurity.ResetAccessRule Method

Adds the specified access control list (ACL) permission to the current file or directory and removes all matching ACL permissions.

Syntax

public void ResetAccessRule (FileSystemAccessRule rule)

Parameters

rule
A System.Security.AccessControl.FileSystemAccessRule object that represents an access control list (ACL) permission to add to a file or directory.

Remarks

The FileSystemSecurity.ResetAccessRule(FileSystemAccessRule) method adds the specified access control list (ACL) rule or overwrites any identical ACL rules that match the rule parameter. For example, if the rule parameter specifies a FileSystemRights.Read value and the FileSystemSecurity.ResetAccessRule(FileSystemAccessRule) method finds an identical ACL rule that specifies the FileSystemRights.Read value, the identical rule will be overwritten. If the FileSystemSecurity.ResetAccessRule(FileSystemAccessRule) method finds an identical ACL rule that specifies the FileSystemRights.Write value, the identical rule will also be overwritten.

To persist new or changed ACL information to a file, use the System.IO.File.SetAccessControl(string, FileSecurity) or System.IO.FileInfo.SetAccessControl(FileSecurity) method. To persist new or changed ACL information to a directory, use the System.IO.Directory.SetAccessControl(string, DirectorySecurity) or System.IO.FileInfo.SetAccessControl(FileSecurity) method.

To retrieve ACL information from a file, use the erload:System.IO.File.GetAccessControl or erload:System.IO.FileInfo.GetAccessControl method. To retrieve ACL information from a directory, use the erload:System.IO.Directory.GetAccessControl or erload:System.IO.DirectoryInfo.GetAccessControl method.

Requirements

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