ConfigurationSection.GetAllowLocation 方法
检索配置节的 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
要求
类型 | 描述 |
---|---|
客户端 | - IIS 7.0(在 Windows Vista 上) - IIS 7.5(在 Windows 7 上) - IIS 8.0(在 Windows 8 上) - IIS 10.0(在 Windows 10 上) |
服务器 | - IIS 7.0(在 Windows Server 2008 上) - IIS 7.5(在 Windows Server 2008 R2 上) - IIS 8.0(在 Windows Server 2012 上) - IIS 8.5(在 Windows Server 2012 R2 上) - IIS 10.0(在 Windows Server 2016 上) |
产品 | - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0 |
MOF 文件 | WebAdministration.mof |
另请参阅
AnonymousAuthenticationSection 类
ConfigurationSection 类
ConfigurationSection.GetAllowDefinition 方法