This documentation is archived and is not being maintained.

FileIOPermissionAttribute.PathDiscovery Property

Gets or sets the file or directory to which to grant path discovery.

[Visual Basic]
Public Property PathDiscovery As String
public string PathDiscovery {get; set;}
public: __property String* get_PathDiscovery();
public: __property void set_PathDiscovery(String*);
public function get PathDiscovery() : String;
public function set PathDiscovery(String);

Property Value

The absolute path of the file or directory.


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.

Note   For performance reasons, PathDiscovery should only be granted to directories, not to files. For example, PathDiscovery permission should be granted to paths such as C:\test and C:\test\, not C:\test\example.txt.

This property sets access for a single file or directory. Use additional attributes to specify additional files and directories.


[Visual Basic] 
' 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()

// Set the PathDiscovery property.
     PathDiscovery = "C:\\Documents and Settings\\All Users")]

// Set the PathDiscovery property.
                           PathDiscovery = S"C:\\Documents and Settings\\All Users")]

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

FileIOPermissionAttribute Class | FileIOPermissionAttribute Members | System.Security.Permissions Namespace