SecurityPolicySection.TrustLevels Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan koleksi.TrustLevels
public:
property System::Web::Configuration::TrustLevelCollection ^ TrustLevels { System::Web::Configuration::TrustLevelCollection ^ get(); };
[System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)]
public System.Web.Configuration.TrustLevelCollection TrustLevels { get; }
[<System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)>]
member this.TrustLevels : System.Web.Configuration.TrustLevelCollection
Public ReadOnly Property TrustLevels As TrustLevelCollection
Nilai Properti
Kumpulan TrustLevels objek.
- Atribut
Contoh
Contoh kode berikut menunjukkan cara menggunakan TrustLevels properti, menambahkan elemen tingkat kepercayaan ke file konfigurasi, dan memperbarui file konfigurasi. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk SecurityPolicySection kelas .
// Display elements of the TrustLevels collection property.
for (int i = 0; i < configSection.TrustLevels.Count; i++)
{
Console.WriteLine();
Console.WriteLine("TrustLevel {0}:", i);
Console.WriteLine("Name: {0}",
configSection.TrustLevels.Get(i).Name);
Console.WriteLine("Type: {0}",
configSection.TrustLevels.Get(i).PolicyFile);
}
// Add a TrustLevel element to the configuration file.
configSection.TrustLevels.Add(new TrustLevel("myTrust", "mytrust.config"));
' Display elements of the TrustLevels collection property.
For i As Integer = 0 To (configSection.TrustLevels.Count - 1)
Console.WriteLine()
Console.WriteLine("TrustLevel {0}:", i)
Console.WriteLine("Name: {0}", _
configSection.TrustLevels.Get(i).Name)
Console.WriteLine("Type: {0}", _
configSection.TrustLevels.Get(i).PolicyFile)
Next i
' Add a TrustLevel element to the configuration file.
configSection.TrustLevels.Add(New TrustLevel("myTrust", "mytrust.config"))
Keterangan
Nilai default untuk properti adalah Full, , High, MediumLow, dan Minimal.TrustLevels Item TrustLevels koleksi masing-masing menentukan nama tingkat keamanan dan file kebijakan terkait. Anda dapat memperluas sistem keamanan dengan menyediakan elemen tingkat kepercayaan bernama Anda sendiri yang dipetakan ke file yang ditentukan oleh policyFile atribut . Untuk informasi tentang membuat elemen tingkat kepercayaan, lihat trustLevel Element untuk securityPolicy (ASP.NET Skema Pengaturan).