VirtualDirectory.RevertToParent Method2
Revierte el valor o los valores de configuración de un directorio virtual al valor predeterminado.
Sintaxis
VirtualDirectory.RevertToParent(PropertyName)
VirtualDirectory.RevertToParent(PropertyName);
Parámetros
Name | Descripción |
---|---|
PropertyName |
Valor opcional string que contiene el nombre de una propiedad de directorio virtual para revertir al valor predeterminado especificado por la clase VirtualDirectoryElementDefaults que se expone como la propiedad VirtualDirectoryDefaults en la clase Application. |
Valor devuelto
Este método no devuelve ningún valor.
Comentarios
Cuando se llama al método RevertToParent
sin parámetros, se quitarán todos los valores de configuración personalizados para el directorio virtual. Si no es el comportamiento que desea, revierta las propiedades específicas mediante llamadas con parámetros al método.
Ejemplo
En el ejemplo siguiente se revierte la propiedad AllowSubDirConfig
del directorio virtual MyVDir
de su valor actual de false
a su valor predeterminado 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 | Descripción |
---|---|
Remoto | - IIS 7.0 en Windows Vista - IIS 7.5 en Windows 7 - IIS 8.0 en Windows 8 - IIS 10.0 en Windows 10 |
Server | - IIS 7.0 en Windows Server 2008 - IIS 7.5 en Windows Server 2008 R2 - IIS 8.0 en Windows Server 2012 - IIS 8.5 en Windows Server 2012 R2 - IIS 10.0 en Windows Server 2016 |
Producto | - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0 |
Archivo MOF | WebAdministration.mof |
Consulte también
Application Class
VirtualDirectory Class
VirtualDirectoryElementDefaults Class