SecurityPolicySection.TrustLevels Własność
Definicja
Ważny
Niektóre informacje dotyczą produktów przedpremierowych, które mogą zostać znacznie zmodyfikowane przed premierą. Microsoft nie udziela żadnych gwarancji, ani wyraźnych, ani domniemanych, dotyczących informacji podanych tutaj.
TrustLevels Pobiera kolekcję.
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
Wartość nieruchomości
Kolekcja obiektów TrustLevels.
- Atrybuty
Przykłady
Poniższy przykład kodu pokazuje, jak używać TrustLevels właściwości, dodać element poziomu zaufania do pliku konfiguracji i zaktualizować plik konfiguracji. Ten przykład kodu jest częścią większego przykładu podanego SecurityPolicySection dla klasy.
// 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"))
Uwagi
Wartości domyślne właściwości TrustLevels to Full, , HighMedium, Lowi Minimal. Elementy TrustLevels kolekcji określają nazwę poziomu zabezpieczeń i skojarzony plik zasad. System zabezpieczeń można rozszerzyć, podając własny nazwany element poziomu zaufania zamapowany na plik określony przez policyFile atrybut. Aby uzyskać informacje na temat tworzenia elementów na poziomie zaufania, zobacz trustLevel, element for securityPolicy (ASP.NET Settings Schema).