VirtualDirectory Class [IIS 7 and higher]
Represents an IIS virtual directory.
The following table lists the methods exposed by the VirtualDirectory class.
The following table lists the properties exposed by the VirtualDirectory class.
A read/write boolean value. true if IIS looks for Web.config files in content directories lower than the current level; false if IIS does not look for these files in directories lower than the current level. The default is true.
A read-only string value that contains the path for the application to which the virtual directory belongs. A key property.
A read/write sint32 enumeration that specifies how a user is locally logged on. The type of logon will determine whether the resulting token can also be used remotely. The possible values are listed later in the Remarks section.
A read/write string value that specifies the encrypted password for access to the physical path for the virtual directory.
A read-only string value that contains the virtual directory path. A key property.
A read/write string value that specifies the physical path associated with the virtual directory.
A read-only string value that contains the name of the Web site to which the virtual directory belongs. A key property.
A read/write string value that specifies a user who has rights to access any configuration files or content in a virtual directory. The default is null.
The following table contains the possible values and keywords for the LogonMethod property. The default is 3 (ClearText). For more information, see the LogonUserEx function.
This logon type is intended for users who will be interactively using the computer.
This logon type is intended for batch servers, where processes may be executing on behalf of a user without their direct intervention. Credentials are not cached for this logon type.
This logon type is intended for high performance servers to authenticate plaintext passwords. Credentials are not cached for this logon type.
This logon type preserves the name and password in the authentication package, which allows the server to make connections to other network servers while impersonating the client.
The following example sets the physical path for the default Web site.
' Connect to the WMI WebAdministration namespace. Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") ' Get the root virtual directory for the default Web site. Set oVDir = oWebAdmin.Get(_ "VirtualDirectory.SiteName='Default Web Site',ApplicationPath='/',Path='/'") ' Set the physical path for the default Web site. oVDir.PhysicalPath = "C:\MyContent" oVDir.Put_