VirtualDirectory Class [IIS 7 and higher]

Represents an IIS virtual directory.

Syntax

class VirtualDirectory : ConfiguredObject

Methods

The following table lists the methods exposed by the VirtualDirectory class.

Name

Description

Create

Creates a virtual directory.

GetAllSections

(Inherited from ConfiguredObject.)

GetSection

(Inherited from ConfiguredObject.)

RevertToParent

Reverts a virtual directory's configuration value or values to those of its parent directory.

Properties

The following table lists the properties exposed by the VirtualDirectory class.

Name

Description

AllowSubDirConfig

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.

ApplicationPath

A read-only string value that contains the path for the application to which the virtual directory belongs. A key property.

LogonMethod

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.

Password

A read/write string value that specifies the encrypted password for access to the physical path for the virtual directory.

Path

A read-only string value that contains the virtual directory path. A key property.

PhysicalPath

A read/write string value that specifies the physical path associated with the virtual directory.

SiteName

A read-only string value that contains the name of the Web site to which the virtual directory belongs. A key property.

UserName

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.

Subclasses

This class contains no subclasses.

Remarks

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.

Value

Keyword

Description

0

Interactive

This logon type is intended for users who will be interactively using the computer.

1

Batch

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.

2

Network

This logon type is intended for high performance servers to authenticate plaintext passwords. Credentials are not cached for this logon type.

3

ClearText

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.

Example

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_

Inheritance Hierarchy

ConfiguredObject

   VirtualDirectory

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

ConfiguredObject Class [IIS 7 and higher]

Object Class [IIS 7 and higher]

Other Resources

LogonUserEx