title | description | ms.date | ms.assetid |
---|---|---|---|
ConfigurationSection.SetAllowLocation Method |
Describes the ConfigurationSection.SetAllowLocation method and provides the method's syntax, parameters, remarks, an example, and requirements. |
10/07/2016 |
ef360cdc-bd3f-4731-8e6c-87d0219903b2 |
Sets the allowLocation
attribute for a configuration section.
ConfigurationSection.SetAllowLocation(AllowLocation)
ConfigurationSection.SetAllowLocation(AllowLocation);
Name | Definition |
---|---|
AllowLocation |
A case-sensitive string variable that sets the allowLocation attribute for the configuration section. The possible attribute values are "true" or "false". The default is "true". Note: This parameter is a string , not a boolean . |
This method does not return a value.
The allowLocation
attribute specifies whether a configuration section can appear inside a pair of location tags.
Because SetAllowLocation
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.SetAllowLocation "false"
The following syntax fails because it tries to call SetAllowLocation
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.SetAllowLocation "false"
The following example sets the allowLocation
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")
' Set the allowLocation attribute.
oAnonAuth.GetAllowLocation "false"
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
ConfigurationSection.GetAllowLocation Method