共用方式為


VirtualDirectory Class2

表示 IIS 虛擬目錄。

Syntax

class VirtualDirectory : ConfiguredObject  

方法

下表列出 類別所 VirtualDirectory 公開的方法。

名稱 描述
建立 建立虛擬目錄。
GetAllSections (繼承自 ConfiguredObject.)
GetSection (繼承自 ConfiguredObject。)
RevertToParent 將虛擬目錄的組態值或值還原為其父目錄的值。

屬性

下表列出 類別所 VirtualDirectory 公開的屬性。

名稱 描述
AllowSubDirConfig 讀取/寫入 boolean 值。 true 如果 IIS 在低於目前層級的內容目錄中尋找Web.config檔案; false 如果 IIS 在低於目前層級的目錄中尋找這些檔案,則為 。 預設值為 true
ApplicationPath 唯讀 string 值,其中包含虛擬目錄所屬應用程式的路徑。 索引鍵屬性。
LogonMethod 讀取/寫入 sint32 列舉,指定使用者在本機登入的方式。 登入類型會判斷產生的權杖是否可以從遠端使用。 可能的值稍後會列在一節中。
Password 讀取/寫入 string 值,指定用來存取虛擬目錄實體路徑的加密密碼。
Path 包含虛擬目錄路徑的唯讀 string 值。 索引鍵屬性。
PhysicalPath 讀取/寫入 string 值,指定與虛擬目錄相關聯的實體路徑。
SiteName 唯讀 string 值,其中包含虛擬目錄所屬的網站名稱。 索引鍵屬性。
UserName 讀取/寫入 string 值,指定有權存取虛擬目錄中任何組態檔或內容的使用者。 預設值為 null

子類別

這個類別不包含子類別。

備註

下表包含 屬性的可能值和關鍵字 LogonMethod 。 預設值為 3 (ClearText) 。 如需詳細資訊,請參閱 LogonUserEx 函式。

關鍵字 描述
0 Interactive 此登入類型適用于以互動方式使用電腦的使用者。
1 Batch 此登入類型適用于批次伺服器,其中進程可能會代表使用者執行,而不需直接介入。 此登入類型不會快取認證。
2 Network 此登入類型適用于高效能伺服器來驗證純文字密碼。 此登入類型不會快取認證。
3 ClearText 此登入類型會保留驗證套件中的名稱和密碼,這可讓伺服器在模擬用戶端時連線到其他網路伺服器。

範例

下列範例會設定預設網站的實體路徑。

' 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_  
  

繼承階層架構

ConfiguredObject

VirtualDirectory

規格需求

類型 描述
Client - Windows Vista 上的 IIS 7.0
- Windows 7 上的 IIS 7.5
- Windows 8 上的 IIS 8.0
- Windows 10上的 IIS 10.0
伺服器 - Windows Server 2008 上的 IIS 7.0
- Windows Server 2008 R2 上的 IIS 7.5
- Windows Server 2012 上的 IIS 8.0
- Windows Server 2012 R2 上的 IIS 8.5
- Windows Server 2016上的 IIS 10.0
產品 - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF 檔案 WebAdministration.mof

另請參閱

ConfiguredObject 類別
物件類別
LogonUserEx