Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

ConfigurationSection.GetAllowLocation Method [IIS 7 and higher]

IIS 7.0

Retrieves the allowLocation attribute for a configuration section.

ConfigurationSection.GetAllowLocation AllowLocation
ConfigurationSection.GetAllowLocation(AllowLocation);

Name

Definition

AllowLocation

A string variable that receives the allowLocation attribute that the GetAllowLocation method returns. The possible attribute values are "true" or "false". The default is "true".

NoteNote:
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 GetAllowLocation 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.GetAllowLocation strAnonAuthAllowLocation

The following syntax fails because it tries to call GetAllowLocation 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.GetAllowLocation strAnonAuthAllowLocation

The following example displays 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")

' Get the allowLocation attribute.
oAnonAuth.GetAllowLocation strAnonAuthAllowLocation

' Display the allowLocation attribute.
WScript.Echo _
    "Anonymous Authentication Allow Location: " & _
        strAnonAuthAllowLocation

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

Community Additions

ADD
Show:
© 2015 Microsoft