FileIOPermissionAttribute.PathDiscovery 屬性

定義

取得或設定要授與路徑探索 (Discovery) 的檔案或目錄。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 屬性,以授與 PathDiscovery 存取指定目錄中的檔案。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\,而不是 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.

適用於