Udostępnij za pośrednictwem


SecurityPolicySection.TrustLevels Właściwość

Definicja

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

Kolekcja TrustLevels obiektów.

Atrybuty

Przykłady

W poniższym przykładzie kodu pokazano, 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 udostępnionego dla klasy SecurityPolicySection.

// 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ę na poziomie zabezpieczeń i skojarzony plik zasad. System zabezpieczeń można rozszerzyć, podając własny nazwany element na poziomie 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