Compartilhar via


VirtualDirectory.RevertToParent Method2

Reverte o valor ou valores de configuração de um diretório virtual para o padrão.

Sintaxe

VirtualDirectory.RevertToParent(PropertyName)  
VirtualDirectory.RevertToParent(PropertyName);  

Parâmetros

Nome Descrição
PropertyName Um valor opcional string que contém o nome de uma propriedade de diretório virtual para reverter para o padrão especificado pela classe VirtualDirectoryElementDefaults que é exposta como a propriedade VirtualDirectoryDefaults na classe Application.

Valor de retorno

Esse método não retorna um valor.

Comentários

Quando você chamar o método RevertToParent sem parâmetros, todos os valores de configuração personalizados para o diretório virtual serão removidos. Se esse não for o comportamento desejado, reverta propriedades específicas usando chamadas parametrizadas para o método.

Exemplo

O exemplo a seguir reverte a propriedade AllowSubDirConfig do diretório virtual MyVDir do valor atual de false para o padrão de true.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject( _  
    "winmgmts:root\WebAdministration")  
  
' Assign the virtual directory instances to a variable.  
Set oVDirs = oWebAdmin.InstancesOf("VirtualDirectory")  
  
' Retrieve the MyVDir virtual directory.  
For Each oVDir In oVDirs  
    If oVDir.Path = "/MyVDir" Then  
  
        ' Display the virtual directory path.  
        WScript.Echo "Virtual Path: " & oVDir.Path  
  
        ' Display the current value.  
        WScript.Echo "AllowSubDirConfig before revert: " & _  
                oVDir.AllowSubDirConfig      
  
        ' Revert the AllowSubDirConfig property.  
        oVdir.RevertToParent("AllowSubDirConfig")  
  
        ' Refresh the oVdir object variable.  
        oVdir.Refresh_  
  
        ' Display the changed value.  
        WScript.Echo "AllowSubDirConfig after revert: " & _  
                oVDir.AllowSubDirConfig   
  
        ' Exit the loop.  
        Exit For   
    End If  
Next  
  
' Output:  
' Virtual Path: /MyVDir  
' AllowSubDirConfig before revert: False  
' AllowSubDirConfig after revert: True  
  

Requisitos

Tipo Descrição
Cliente – IIS 7.0 no Windows Vista
– IIS 7.5 no Windows 7
– IIS 8.0 no Windows 8
– IIS 10.0 no Windows 10
Servidor – IIS 7.0 no Windows Server 2008
– IIS 7.5 no Windows Server 2008 R2
– IIS 8.0 no Windows Server 2012
– IIS 8.5 no Windows Server 2012 R2
– IIS 10.0 no Windows Server 2016
Product – IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
Arquivo MOF WebAdministration.mof

Confira também

Classe Application
Classe VirtualDirectory
Classe VirtualDirectoryElementDefaults