FileIOPermissionAttribute.PathDiscovery 属性

定义

获取或设置针对其授予路径发现权限的文件或目录。Gets or sets the file or directory to which to grant path discovery.

public:
 property System::String ^ PathDiscovery { System::String ^ get(); void set(System::String ^ value); };
public string PathDiscovery { get; set; }
member this.PathDiscovery : string with get, set
Public Property PathDiscovery As String

属性值

文件或目录的绝对路径。The absolute path of the file or directory.

示例

下面的代码示例将 PathDiscovery 属性设置为向 @no__t 授予对指定目录中文件的访问权限。The following code example sets the PathDiscovery property to grant PathDiscovery access to files in the specified directory.

// Set the PathDiscovery property.
[FileIOPermissionAttribute(SecurityAction::PermitOnly,
PathDiscovery="C:\\Documents and Settings\\All Users")]
// Set the PathDiscovery property.
[FileIOPermissionAttribute(SecurityAction.PermitOnly,
     PathDiscovery = "C:\\Documents and Settings\\All Users")]
' Set the Read, PathDiscovery, Append, Write, and All properties.
<FileIOPermissionAttribute(SecurityAction.PermitOnly, Read:="C:\"), _
FileIOPermissionAttribute(SecurityAction.PermitOnly, _
PathDiscovery:="C:\Documents and Settings\All Users"), _
FileIOPermissionAttribute(SecurityAction.PermitOnly, _
Append:="C:\Documents and Settings\All Users\Application Data"), _
FileIOPermissionAttribute(SecurityAction.PermitOnly, _
    Write:="C:\Documents and Settings\All Users\Application Data\Microsoft"), _
FileIOPermissionAttribute(SecurityAction.PermitOnly, _
    All:="C:\Documents and Settings\All Users\Application Data\Microsoft\Network")> _
Public Shared Sub PermitOnlyMethod()

注解

路径发现控制对路径本身中的信息的访问。Path discovery controls access to the information in the path itself. 这可以保护路径中的敏感信息(如用户名)以及有关路径中显示的目录结构的信息。This helps protect sensitive information in the path, such as user names, as well as information about the directory structure revealed in the path. 此值不授予对路径所指代的文件或文件夹的访问权限。This value does not grant access to files or folders represented by the path.

备注

出于性能方面的考虑,应仅将 PathDiscovery 授予目录而非文件。For performance reasons, PathDiscovery should be granted only to directories, not to files. 例如,应将 PathDiscovery 权限授予 C:\test 和 C:\test @ no__t 等路径,而不授予 C:\test\example.txt. 等文件的权限。For example, PathDiscovery permission should be granted to paths such as C:\test and C:\test\, not to files such as C:\test\example.txt.

此属性设置单个文件或目录的访问权限。This property sets access for a single file or directory. 使用其他属性来指定其他文件和目录。Use additional attributes to specify additional files and directories.

适用于