SecurityPolicySection.TrustLevels Eigenschap

Definitie

Haalt de TrustLevels verzameling op.

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

Waarde van eigenschap

Een verzameling TrustLevels objecten.

Kenmerken

Voorbeelden

In het volgende codevoorbeeld ziet u hoe u de TrustLevels eigenschap gebruikt, een element op vertrouwensniveau toevoegt aan het configuratiebestand en het configuratiebestand bijwerkt. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de SecurityPolicySection klasse.

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

Opmerkingen

De standaardwaarden voor de TrustLevels eigenschap zijn Full, High, Medium, en LowMinimal. De items van de TrustLevels verzameling geven elk een naam op beveiligingsniveau en een gekoppeld beleidsbestand op. U kunt het beveiligingssysteem uitbreiden door uw eigen element op vertrouwensniveau op te geven dat is toegewezen aan een bestand dat is opgegeven door het policyFile kenmerk. Zie trustLevel-element voor securityPolicy (ASP.NET Settings Schema) voor informatie over het maken van elementen op vertrouwensniveau.

Van toepassing op