ConfigurationSection.SetAllowLocation メソッド

構成セクションの allowLocation 属性を設定します。

構文

ConfigurationSection.SetAllowLocation(AllowLocation)  
ConfigurationSection.SetAllowLocation(AllowLocation);  

Parameters

名前 Definition
AllowLocation 構成セクションの allowLocation 属性を設定する、大文字と小文字を区別する string 変数。 入力可能値は「true」または「false」です。 既定値は "true" です。 注: このパラメーターは boolean ではなく string です。

戻り値

このメソッドは値を返しません。

解説

allowLocation 属性は、location タグのペア内に構成セクションを含めることができるかどうかを指定します。

SetAllowLocation は静的メソッドであるため、次の例のようにクラス オブジェクトを取得して呼び出す必要があります。

' Correct syntax:  
Set oAnonAuth = oWebAdmin.Get("AnonymousAuthenticationSection")  
oAnonAuth.SetAllowLocation "false"  

Site クラスの具象インスタンスで SetAllowLocation を呼び出そうとするため、次の構文は失敗します。 メソッドを呼び出すと、"SWbemObjectEx: Not found" エラーが発生します。

  
' Incorrect syntax:  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
oSite.GetSection "AnonymousAuthenticationSection", oAnonAuth  
oAnonAuth.SetAllowLocation "false"  

次の例では、匿名認証構成セクションの allowLocation 属性を設定します。

' Get the WebAdministration namespace.  
Set oWebAdmin = GetObject( _  
    "winmgmts:root\WebAdministration")  
  
' Get the AnonymousAuthenticationSection.  
Set oAnonAuth = oWebAdmin.Get( _  
    "AnonymousAuthenticationSection")  
  
' Set the allowLocation attribute.  
oAnonAuth.GetAllowLocation "false"  
  

要件

説明
クライアント - 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
Product - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF ファイル WebAdministration.mof

参照

AnonymousAuthenticationSection クラス
ConfigurationSection クラス
ConfigurationSection.GetAllowLocation メソッド