Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Sets the allowLocation attribute for a configuration section.
Syntax
ConfigurationSection.SetAllowLocation(AllowLocation)
ConfigurationSection.SetAllowLocation(AllowLocation);
Parameters
| 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. |
Return Value
This method does not return a value.
Remarks
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"
Example
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"
Requirements
| Type | Description |
|---|---|
| Client | - IIS 7.0 on Windows Vista - IIS 7.5 on Windows 7 - IIS 8.0 on Windows 8 - IIS 10.0 on Windows 10 |
| Server | - IIS 7.0 on Windows Server 2008 - IIS 7.5 on Windows Server 2008 R2 - IIS 8.0 on Windows Server 2012 - IIS 8.5 on Windows Server 2012 R2 - IIS 10.0 on Windows Server 2016 |
| Product | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
| MOF file | WebAdministration.mof |
See Also
AnonymousAuthenticationSection Class
ConfigurationSection Class
ConfigurationSection.GetAllowLocation Method