Sdílet prostřednictvím


SecurityPolicySection.TrustLevels Vlastnost

Definice

Získá kolekci 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

Hodnota vlastnosti

TrustLevelCollection

Kolekce objektů TrustLevels.

Atributy

Příklady

Následující příklad kódu ukazuje, jak použít TrustLevels vlastnost, přidat element na úrovni důvěryhodnosti do konfiguračního souboru a aktualizovat konfigurační soubor. Tento příklad kódu je součástí většího příkladu zadaného SecurityPolicySection pro třídu.

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

Poznámky

Výchozí hodnoty vlastnosti TrustLevels jsou , , High, Mediuma Low``Minimal.Full Položky TrustLevels kolekce určují název na úrovni zabezpečení a přidružený soubor zásad. Systém zabezpečení můžete rozšířit tak, že zadáte vlastní pojmenovaný element na úrovni důvěryhodnosti namapovaný na soubor určený atributem policyFile . Informace o vytváření elementů na úrovni důvěryhodnosti najdete v tématu trustLevel – element pro securityPolicy (ASP.NET Nastavení Schéma).

Platí pro