FileIOPermissionAttribute.PathDiscovery 属性


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

 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 属性设置为授予对指定目录中文件的 PathDiscovery 访问权限。The following code example sets the PathDiscovery property to grant PathDiscovery access to files in the specified directory.

// Set the PathDiscovery property.
PathDiscovery="C:\\Documents and Settings\\All Users")]
// Set the PathDiscovery property.
     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\,而不是 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.