Bagikan melalui


SectionInformation.IsProtected Properti

Definisi

Mendapatkan nilai yang menunjukkan apakah bagian konfigurasi terkait dilindungi.

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

Nilai Properti

true jika ini ConfigurationSection dilindungi; jika tidak, false. Default adalah false.

Contoh

Contoh di bagian ini menunjukkan cara mendapatkan IsProtected nilai properti setelah mengakses informasi bagian terkait dalam file konfigurasi.

Contoh berikut mendapatkan SectionInformation objek .

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

Contoh berikut mendapatkan nilainya IsProtected .

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

Keterangan

Bagian konfigurasi yang dilindungi dienkripsi dan baca-saja.

Untuk informasi selengkapnya tentang bagian konfigurasi yang dilindungi, lihat Mengenkripsi Informasi Konfigurasi Menggunakan Konfigurasi Terproteksi.

Berlaku untuk

Lihat juga