Condividi tramite


Metodo ConfigurationSection.GetAllowLocation

Recupera l'attributo allowLocation per una sezione di configurazione.

Sintassi

ConfigurationSection.GetAllowLocation AllowLocation  
ConfigurationSection.GetAllowLocation(AllowLocation);  

Parametri

Nome Definizione
AllowLocation Variabile string che riceve l'attributo allowLocation restituito dal GetAllowLocation metodo. I valori degli attributi possibili sono "true" o "false". Il valore predefinito è "true". Nota: Questo parametro è un stringoggetto , non un booleanoggetto .

Valore restituito

Questo metodo non restituisce valori.

Commenti

L'attributo allowLocation specifica se una sezione di configurazione può essere visualizzata all'interno di una coppia di tag di posizione.

Poiché GetAllowLocation è un metodo statico, è consigliabile chiamarlo recuperando un oggetto classe, come nell'esempio seguente.

' Correct syntax:  
Set oAnonAuth = oWebAdmin.Get("AnonymousAuthenticationSection")  
oAnonAuth.GetAllowLocation strAnonAuthAllowLocation  

La sintassi seguente ha esito negativo perché tenta di chiamare GetAllowLocation su un'istanza concreta della Site classe. La chiamata al metodo causerà un errore "SWbemObjectEx: Not found".

  
' Incorrect syntax:  
Set oSite = oWebAdmin.Get("Site.Name='Default Web Site'")  
oSite.GetSection "AnonymousAuthenticationSection", oAnonAuth  
oAnonAuth.GetAllowLocation strAnonAuthAllowLocation  

Esempio

Nell'esempio seguente viene visualizzato l'attributo allowLocation per la sezione Configurazione di autenticazione anonima.

' 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  
  

Requisiti

Tipo Descrizione
Client - IIS 7.0 in Windows Vista
- IIS 7.5 in Windows 7
- IIS 8.0 in Windows 8
- IIS 10.0 in Windows 10
Server - IIS 7.0 in Windows Server 2008
- IIS 7.5 in Windows Server 2008 R2
- IIS 8.0 in Windows Server 2012
- IIS 8.5 in Windows Server 2012 R2
- IIS 10.0 in Windows Server 2016
Prodotto - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
File MOF WebAdministration.mof

Vedere anche

Classe AnonymousAuthenticationSection
Classe ConfigurationSection
Metodo ConfigurationSection.GetAllowDefinition