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 zamapowany na plik określony przez policyFile atrybut .

Konstruktory

Nazwa Opis
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

Nazwa Opis
CurrentConfiguration

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

(Odziedziczone po ConfigurationElement)
ElementInformation

Pobiera obiekt ElementInformation zawierający informacje i funkcje obiektu ConfigurationElement, które nie można dostosowywać.

(Odziedziczone po ConfigurationElement)
ElementProperty

Pobiera obiekt ConfigurationElementProperty reprezentujący sam obiekt ConfigurationElement.

(Odziedziczone po ConfigurationElement)
EvaluationContext

Pobiera obiekt ContextInformation dla obiektu ConfigurationElement.

(Odziedziczone po ConfigurationElement)
HasContext

Pobiera wartość wskazującą, czy właściwość CurrentConfiguration jest 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

Nazwa Opis
DeserializeElement(XmlReader, Boolean)

Odczytuje kod XML z pliku konfiguracji.

(Odziedziczone po ConfigurationElement)
Equals(Object)

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

(Odziedziczone po ConfigurationElement)
GetHashCode()

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

(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()

Pobiera Type bieżącego wystąpienia.

(Odziedziczone po Object)
Init()

Ustawia obiekt ConfigurationElement na stan początkowy.

(Odziedziczone po ConfigurationElement)
InitializeDefault()

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

(Odziedziczone po ConfigurationElement)
IsModified()

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

(Odziedziczone po ConfigurationElement)
IsReadOnly()

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

(Odziedziczone po ConfigurationElement)
ListErrors(IList)

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

(Odziedziczone po ConfigurationElement)
MemberwiseClone()

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

(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 wewnętrzny obiektu ConfigurationElement, w tym blokady i kolekcje właściwości.

(Odziedziczone po ConfigurationElement)
ResetModified()

Resetuje wartość metody IsModified(), aby false po zaimplementowaniu w klasie pochodnej.

(Odziedziczone po ConfigurationElement)
SerializeElement(XmlWriter, Boolean)

Zapisuje zawartość tego elementu konfiguracji w 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()

Ustawia właściwość IsReadOnly() dla obiektu ConfigurationElement 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 ConfigurationElement, aby usunąć wszystkie wartości, które nie powinny być zapisywane.

(Odziedziczone po ConfigurationElement)

Dotyczy

Zobacz też