擷 allowLocation 取組態區段的屬性。
語法
ConfigurationSection.GetAllowLocation AllowLocation
ConfigurationSection.GetAllowLocation(AllowLocation);
參數
| 名稱 | 定義 |
|---|---|
AllowLocation |
接收 string 方法傳回之屬性的 GetAllowLocation 變數 allowLocation 。 可能的屬性值為 「true」 或 「false」。 預設為 "true"。 注意: 這個參數是 string ,而不是 boolean 。 |
傳回值
這個方法不會傳回值。
備註
屬性 allowLocation 會指定組態區段是否可以出現在一對位置標籤內。
因為 GetAllowLocation 是靜態方法,所以您應該藉由取得類別物件來呼叫它,如下列範例所示。
' Correct syntax:
Set oAnonAuth = oWebAdmin.Get("AnonymousAuthenticationSection")
oAnonAuth.GetAllowLocation strAnonAuthAllowLocation
下列語法會失敗,因為它嘗試在 類別的具體 Site 實例上呼叫 GetAllowLocation 。 呼叫 方法會導致 「SWbemObjectEx: 找不到」錯誤。
' Incorrect syntax:
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")
oSite.GetSection "AnonymousAuthenticationSection", oAnonAuth
oAnonAuth.GetAllowLocation strAnonAuthAllowLocation
範例
下列範例會顯示 allowLocation 匿名驗證組態區段的屬性。
' Get the WebAdministration namespace.
Set oWebAdmin = GetObject( _
"winmgmts:root\WebAdministration")
' Get the AnonymousAuthenticationSection.
Set oAnonAuth = oWebAdmin.Get( _
"AnonymousAuthenticationSection")
' Get the allowLocation attribute.
oAnonAuth.GetAllowLocation strAnonAuthAllowLocation
' Display the allowLocation attribute.
WScript.Echo _
"Anonymous Authentication Allow Location: " & _
strAnonAuthAllowLocation
規格需求
| 類型 | 描述 |
|---|---|
| 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 |
另請參閱
AnonymousAuthenticationSection 類別
ConfigurationSection 類別
ConfigurationSection.GetAllowDefinition 方法