SectionInformation.IsProtected Propiedad

Definición

Obtiene un valor que indica si la sección de configuración asociada está protegida.

public:
 property bool IsProtected { bool get(); };
public bool IsProtected { get; }
member this.IsProtected : bool
Public ReadOnly Property IsProtected As Boolean

Valor de propiedad

Es true si este objeto ConfigurationSection está protegido; de lo contrario, es false. De manera predeterminada, es false.

Ejemplos

Los ejemplos de esta sección muestran cómo obtener el valor de propiedad IsProtected después de acceder a la información de sección relacionada en el archivo de configuración.

En el ejemplo siguiente se obtiene el SectionInformation objeto .

// Get the current configuration file.
System.Configuration.Configuration config =
        ConfigurationManager.OpenExeConfiguration(
        ConfigurationUserLevel.None);

// Get the section.
UrlsSection section =
    (UrlsSection)config.GetSection("MyUrls");

SectionInformation sInfo =
    section.SectionInformation;
' Get the current configuration file.
Dim config _
As System.Configuration.Configuration = _
ConfigurationManager.OpenExeConfiguration( _
ConfigurationUserLevel.None)

' Get the section.
Dim section As UrlsSection = _
CType(config.GetSection("MyUrls"), UrlsSection)
        
Dim sInfo As SectionInformation = _
section.SectionInformation

En el ejemplo siguiente se obtiene el IsProtected valor .

bool protect =
    sInfo.IsProtected;
Console.WriteLine("Section protected?: {0}",
    protect.ToString());
Dim protect As Boolean = _
sInfo.IsProtected
Console.WriteLine("Section protected?: {0}", _
protect.ToString())

Comentarios

Las secciones de configuración protegidas se cifran y solo lectura.

Para obtener más información sobre las secciones de configuración protegida, vea Cifrar la información de configuración mediante la configuración protegida.

Se aplica a

Consulte también