Share via


SecurityPolicySection.TrustLevels Propiedad

Definición

Obtiene la colección 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

Valor de propiedad

TrustLevelCollection

Una colección de objetos TrustLevels.

Atributos

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar la TrustLevels propiedad , agregar un elemento de nivel de confianza al archivo de configuración y actualizar el archivo de configuración. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la SecurityPolicySection clase .

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

Comentarios

Los valores predeterminados de la TrustLevels propiedad son Full, , High``Medium, Lowy Minimal. Los elementos de la TrustLevels colección especifican un nombre de nivel de seguridad y un archivo de directiva asociado. Puede ampliar el sistema de seguridad proporcionando su propio elemento de nivel de confianza con nombre asignado a un archivo especificado por el policyFile atributo . Para obtener información sobre cómo crear elementos de nivel de confianza, vea trustLevel Element for securityPolicy (ASP.NET Configuración Schema).

Se aplica a