TrustLevel Klasa

Definicja

Definiuje mapowanie określonych poziomów zabezpieczeń na nazwane pliki zasad. Klasa ta nie może być dziedziczona.

public ref class TrustLevel sealed : System::Configuration::ConfigurationElement
public sealed class TrustLevel : System.Configuration.ConfigurationElement
type TrustLevel = class
    inherit ConfigurationElement
Public NotInheritable Class TrustLevel
Inherits ConfigurationElement
Dziedziczenie

Przykłady

W poniższym przykładzie kodu pokazano, jak używać TrustLevel typu.

#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Web;
using System.Web.Configuration;

#endregion

namespace Samples.Aspnet.SystemWebConfiguration
{
  class UsingTrustLevel
  {
    static void Main(string[] args)
    {
      try
      {
        // Display title.
        Console.WriteLine("ASP.NET TrustLevel Info");
        Console.WriteLine();

        // Instantiate a new TrustLevel object.
        TrustLevel TrustLevel1 =
          new TrustLevel("myLevel1", "myLevel1.config");

        // Get the Name of the TrustLevel object.
        Console.WriteLine("Name: {0}", TrustLevel1.Name);

        // Instantiate a new TrustLevel object.
        TrustLevel TrustLevel2 =
          new TrustLevel("myLevel2", "myLevel2.config");

        // Get the PolicyFile of the TrustLevel object.
        Console.WriteLine("PolicyFile: {0}", TrustLevel2.PolicyFile);
      }

      catch (Exception e)
      {
        // Unknown error.
        Console.WriteLine(e.ToString());
      }

      // Display and wait.
      Console.ReadLine();
    }
  }
}
Imports System.Collections.Generic
Imports System.Text
Imports System.Configuration
Imports System.Web
Imports System.Web.Configuration

Namespace Samples.Aspnet.SystemWebConfiguration
  Class UsingTrustLevel
    Public Shared Sub Main()
      Try
        ' Display title.
        Console.WriteLine("ASP.NET TrustLevel Info")
        Console.WriteLine()

        ' Instantiate a new TrustLevel object.
        Dim TrustLevel1 As TrustLevel = _
          New TrustLevel("myLevel1", "myLevel1.config")

        ' Get the Name of the TrustLevel object.
        Console.WriteLine("Name: {0}", TrustLevel1.Name)

        ' Instantiate a new TrustLevel object.
        Dim TrustLevel2 As TrustLevel = _
          New TrustLevel("myLevel2", "myLevel2.config")

        ' Get the PolicyFile of the TrustLevel object.
        Console.WriteLine("PolicyFile: {0}", TrustLevel2.PolicyFile)

      Catch e As Exception
        ' Unknown error.
        Console.WriteLine(e.ToString())
      End Try

      ' Display and wait.
      Console.ReadLine()
    End Sub
  End Class
End Namespace

Uwagi

Zabezpieczenia aplikacji internetowej można rozszerzyć, tworząc własny nazwany TrustLevel obiekt, który jest mapowany na plik określony przez policyFile atrybut .

Konstruktory

TrustLevel(String, String)

Tworzy wystąpienie TrustLevel klasy, która jest inicjowana na podstawie podanych wartości, które definiują mapowanie określonych poziomów zabezpieczeń na nazwane pliki zasad.

Właściwości

CurrentConfiguration

Pobiera odwołanie do wystąpienia najwyższego poziomu Configuration reprezentującego hierarchię konfiguracji, do którego należy bieżące ConfigurationElement wystąpienie.

(Odziedziczone po ConfigurationElement)
ElementInformation

ElementInformation Pobiera obiekt, który zawiera informacje i funkcje ConfigurationElement obiektu, które nie można dostosowywać.

(Odziedziczone po ConfigurationElement)
ElementProperty

ConfigurationElementProperty Pobiera obiekt reprezentujący ConfigurationElement sam obiekt.

(Odziedziczone po ConfigurationElement)
EvaluationContext

ContextInformation Pobiera obiekt dla ConfigurationElement obiektu.

(Odziedziczone po ConfigurationElement)
HasContext

Pobiera wartość wskazującą CurrentConfiguration , czy właściwość ma wartość null.

(Odziedziczone po ConfigurationElement)
Item[ConfigurationProperty]

Pobiera lub ustawia właściwość lub atrybut tego elementu konfiguracji.

(Odziedziczone po ConfigurationElement)
Item[String]

Pobiera lub ustawia właściwość, atrybut lub element podrzędny tego elementu konfiguracji.

(Odziedziczone po ConfigurationElement)
LockAllAttributesExcept

Pobiera kolekcję zablokowanych atrybutów.

(Odziedziczone po ConfigurationElement)
LockAllElementsExcept

Pobiera kolekcję zablokowanych elementów.

(Odziedziczone po ConfigurationElement)
LockAttributes

Pobiera kolekcję zablokowanych atrybutów.

(Odziedziczone po ConfigurationElement)
LockElements

Pobiera kolekcję zablokowanych elementów.

(Odziedziczone po ConfigurationElement)
LockItem

Pobiera lub ustawia wartość wskazującą, czy element jest zablokowany.

(Odziedziczone po ConfigurationElement)
Name

Pobiera lub ustawia nazwany poziom zabezpieczeń mapowany na plik zasad.

PolicyFile

Pobiera lub ustawia odwołanie do pliku konfiguracji zawierające ustawienia zasad zabezpieczeń dla nazwanego poziomu zabezpieczeń.

Properties

Pobiera kolekcję właściwości.

(Odziedziczone po ConfigurationElement)

Metody

DeserializeElement(XmlReader, Boolean)

Odczytuje kod XML z pliku konfiguracji.

(Odziedziczone po ConfigurationElement)
Equals(Object)

Porównuje bieżące ConfigurationElement wystąpienie z określonym obiektem.

(Odziedziczone po ConfigurationElement)
GetHashCode()

Pobiera unikatową wartość reprezentującą bieżące ConfigurationElement wystąpienie.

(Odziedziczone po ConfigurationElement)
GetTransformedAssemblyString(String)

Zwraca przekształconą wersję określonej nazwy zestawu.

(Odziedziczone po ConfigurationElement)
GetTransformedTypeString(String)

Zwraca przekształconą wersję określonej nazwy typu.

(Odziedziczone po ConfigurationElement)
GetType()

Type Pobiera wartość bieżącego wystąpienia.

(Odziedziczone po Object)
Init()

ConfigurationElement Ustawia obiekt na stan początkowy.

(Odziedziczone po ConfigurationElement)
InitializeDefault()

Służy do inicjowania domyślnego zestawu wartości dla ConfigurationElement obiektu.

(Odziedziczone po ConfigurationElement)
IsModified()

Wskazuje, czy ten element konfiguracji został zmodyfikowany od czasu ostatniego zapisania lub załadowania, podczas implementacji w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
IsReadOnly()

Pobiera wartość wskazującą, czy ConfigurationElement obiekt jest tylko do odczytu.

(Odziedziczone po ConfigurationElement)
ListErrors(IList)

Dodaje błędy nieprawidłowej właściwości w tym ConfigurationElement obiekcie i we wszystkich podelementach do przekazanej listy.

(Odziedziczone po ConfigurationElement)
MemberwiseClone()

Tworzy płytkią kopię bieżącego Objectelementu .

(Odziedziczone po Object)
OnDeserializeUnrecognizedAttribute(String, String)

Pobiera wartość wskazującą, czy podczas deserializacji napotkano nieznany atrybut.

(Odziedziczone po ConfigurationElement)
OnDeserializeUnrecognizedElement(String, XmlReader)

Pobiera wartość wskazującą, czy podczas deserializacji napotkano nieznany element.

(Odziedziczone po ConfigurationElement)
OnRequiredPropertyNotFound(String)

Zgłasza wyjątek, gdy nie można odnaleźć wymaganej właściwości.

(Odziedziczone po ConfigurationElement)
PostDeserialize()

Wywoływana po deserializacji.

(Odziedziczone po ConfigurationElement)
PreSerialize(XmlWriter)

Wywoływana przed serializacji.

(Odziedziczone po ConfigurationElement)
Reset(ConfigurationElement)

Resetuje stan ConfigurationElement wewnętrzny obiektu, w tym blokady i kolekcje właściwości.

(Odziedziczone po ConfigurationElement)
ResetModified()

Resetuje wartość IsModified() metody w false przypadku implementacji w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
SerializeElement(XmlWriter, Boolean)

Zapisuje zawartość tego elementu konfiguracji do pliku konfiguracji po zaimplementowaniu w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
SerializeToXmlElement(XmlWriter, String)

Zapisuje zewnętrzne tagi tego elementu konfiguracji do pliku konfiguracji po zaimplementowaniu w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
SetPropertyValue(ConfigurationProperty, Object, Boolean)

Ustawia właściwość na określoną wartość.

(Odziedziczone po ConfigurationElement)
SetReadOnly()

IsReadOnly() Ustawia właściwość dla ConfigurationElement obiektu i wszystkich podelementów.

(Odziedziczone po ConfigurationElement)
ToString()

Zwraca ciąg reprezentujący bieżący obiekt.

(Odziedziczone po Object)
Unmerge(ConfigurationElement, ConfigurationElement, ConfigurationSaveMode)

Modyfikuje obiekt w ConfigurationElement celu usunięcia wszystkich wartości, które nie powinny być zapisywane.

(Odziedziczone po ConfigurationElement)

Dotyczy

Zobacz też