SecurityPolicySection.TrustLevels Właściwość

Definicja

TrustLevels Pobiera kolekcję.

C#
[System.Configuration.ConfigurationProperty("", IsDefaultCollection=true)]
public System.Web.Configuration.TrustLevelCollection TrustLevels { get; }

Wartość właściwoś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.

C#
// 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"));

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).

Dotyczy

Produkt Wersje
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1