title | description | ms.date | ms.assetid |
---|---|---|---|
ConfigurationSection.GetAllowDefinition Method |
This article describes the ConfigurationSection.GetAllowDefinition method and provides syntax, parameters, and requirements. |
10/07/2016 |
d8a84cd4-8cdb-48bf-a50e-2fbcabba56db |
Retrieves the allowDefinition
attribute for a configuration section.
ConfigurationSection.GetAllowDefinition AllowDefinition
ConfigurationSection.GetAllowDefinition(AllowDefinition);
Name | Definition |
---|---|
AllowDefinition |
A string variable that receives the allowDefinition attribute that the GetAllowDefinition method returns. The possible attribute values are listed later in the Remarks section. |
This method does not return a value.
allowDefinition
attributes specify where in the configuration hierarchy values may be set for a given configuration section. These attributes are specified in the <configSections>
section of the ApplicationHost.config file.
Because GetAllowDefinition
is a static method, you should call it by getting a class object, as in the following example.
' Correct syntax:
Set oAnonAuth = oWebAdmin.Get("AnonymousAuthenticationSection")
oAnonAuth.GetAllowDefinition strAnonAuthAllowDefinition
The following syntax fails because it tries to call GetAllowDefinition
on a concrete instance of the Site
class. The call to the method will cause an "SWbemObjectEx: Not found" error.
' Incorrect syntax:
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")
oSite.GetSection "AnonymousAuthenticationSection", oAnonAuth
oAnonAuth.GetAllowDefinition strAnonAuthAllowDefinition
The following table lists the possible values for the allowDefinition
attribute.
Keyword | Description |
---|---|
Everywhere |
The section can be set anywhere in the hierarchy. |
MachineOnly |
The section can be set only in the Machine.config file. Note: The default location for the Machine.config file is %systemroot% Microsoft.NET\Framework\<version>\config\. |
MachineToWebRoot |
The section can be set only in the Machine.config file or the root Web.config file. Note: The default location for the root Web.config file is %systemroot% Microsoft.NET\Framework\<version>\config\. |
AppHostOnly |
The section can be set only in the ApplicationHost.config file. |
MachineToApplication |
The section can be set only at the global level. For [!INCLUDEdnprdnshort] sections, the global level is the root Web.config or Machine.config file; for IIS sections, it is the ApplicationHost.config file; and for applications, it is the Web.config file for the root application. |
The following example displays the allowDefinition
attribute for the Anonymous authentication configuration section.
' Get the WebAdministration namespace.
Set oWebAdmin = GetObject( _
"winmgmts:root\WebAdministration")
' Get the AnonymousAuthenticationSection.
Set oAnonAuth = oWebAdmin.Get( _
"AnonymousAuthenticationSection")
' Get the allowDefinition attribute.
oAnonAuth.GetAllowDefinition strAnonAuthAllowDefinition
' Display the allowDefinition attribute.
WScript.Echo _
"Anonymous Authentication Allow Definition: " & _
strAnonAuthAllowDefinition
Type | Description |
---|---|
Client | - [!INCLUDEiis70] on [!INCLUDEwinvista] - [!INCLUDEiis75] on [!INCLUDEwin7] - [!INCLUDEiis80] on [!INCLUDEwin8] - [!INCLUDEiis100] on [!INCLUDEwin10] |
Server | - [!INCLUDEiis70] on [!INCLUDEwinsrv2008] - [!INCLUDEiis75] on [!INCLUDEwinsrv2008r2] - [!INCLUDEiis80] on [!INCLUDEwinsrv2012] - [!INCLUDEiis85] on [!INCLUDEwinsrv2012r2] - [!INCLUDEiis100] on [!INCLUDEwinsrv2016] |
Product | - [!INCLUDEiis70], [!INCLUDEiis75], [!INCLUDEiis80], [!INCLUDEiis85], [!INCLUDEiis100] |
MOF file | WebAdministration.mof |
AnonymousAuthenticationSection Class
ConfigurationSection Class