SectionInformation.IsProtected Propriété

Définition

Obtient une valeur qui indique si la section de configuration associée est protégée.

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

Valeur de propriété

true si ce ConfigurationSection est protégé ; sinon, false. La valeur par défaut est false.

Exemples

Les exemples de cette section montrent comment obtenir la valeur de propriété IsProtected après avoir accédé aux informations de section associées dans le fichier de configuration.

L’exemple suivant obtient l’objet SectionInformation .

// 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

L’exemple suivant obtient la IsProtected valeur .

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

Remarques

Les sections de configuration protégées sont chiffrées et en lecture seule.

Pour plus d’informations sur les sections de configuration protégée, consultez Chiffrement des informations de configuration à l’aide de la configuration protégée.

S’applique à

Voir aussi