WebSuccessAuditEvent Klasa

Definicja

Zawiera informacje o pomyślnych zdarzeniach zabezpieczeń.

public ref class WebSuccessAuditEvent : System::Web::Management::WebAuditEvent
public class WebSuccessAuditEvent : System.Web.Management.WebAuditEvent
type WebSuccessAuditEvent = class
    inherit WebAuditEvent
Public Class WebSuccessAuditEvent
Inherits WebAuditEvent
Dziedziczenie
Pochodne

Przykłady

Poniższy przykład kodu pokazuje, jak pochodzić z klasy w WebSuccessAuditEvent celu utworzenia niestandardowego zdarzenia inspekcji.


using System;
using System.Text;
using System.Web;
using System.Web.Management;

namespace SamplesAspNet
{
    // Implements a custom WebSuccessAuditEvent class. 
    public class SampleWebSuccessAuditEvent :
        System.Web.Management.WebSuccessAuditEvent
    {
        private string customCreatedMsg, customRaisedMsg;

        // Invoked in case of events identified only by their event code.
        public SampleWebSuccessAuditEvent(string msg, 
            object eventSource, int eventCode)
            :
        base(msg, eventSource, eventCode)
        {
            // Perform custom initialization.
            customCreatedMsg =
                string.Format("Event created at: {0}",
                DateTime.Now.TimeOfDay.ToString());
        }

        // Invoked in case of events identified by their event code.and 
        // event detailed code.
        public SampleWebSuccessAuditEvent(string msg, object eventSource,
            int eventCode, int detailedCode)
            :
        base(msg, eventSource, eventCode, detailedCode)
        {
            // Perform custom initialization.
            customCreatedMsg =
            string.Format("Event created at: {0}",
                DateTime.Now.TimeOfDay.ToString());
        }


        // Raises the SampleWebSuccessAuditEvent.
        public override void Raise()
        {
            // Perform custom processing.
            customRaisedMsg =
                string.Format("Event raised at: {0}", 
                DateTime.Now.TimeOfDay.ToString());

            // Raise the event.
            WebBaseEvent.Raise(this);
        }

        // Obtains the current thread information.
        public WebRequestInformation GetRequestInformation()
        {
            // No customization allowed.
            return RequestInformation;
        }

        //Formats Web request event information.
        //This method is invoked indirectly by the provider using one of the
        //overloaded ToString methods.
        public override void FormatCustomEventDetails(WebEventFormatter formatter)
        {
            base.FormatCustomEventDetails(formatter);

            // Add custom data.
            formatter.AppendLine("");

            formatter.IndentationLevel += 1;
            formatter.AppendLine(
                "******** SampleWebSuccessAuditEvent Start ********");
            formatter.AppendLine(string.Format("Request path: {0}",
                RequestInformation.RequestPath));
            formatter.AppendLine(string.Format("Request Url: {0}",
                RequestInformation.RequestUrl));

            // Display custom event timing.
            formatter.AppendLine(customCreatedMsg);
            formatter.AppendLine(customRaisedMsg);

            formatter.AppendLine(
                "******** SampleWebSuccessAuditEvent End ********");

            formatter.IndentationLevel -= 1;
        }
    }
}
Imports System.Text
Imports System.Web
Imports System.Web.Management


' Implements a custom WebSuccessAuditEvent class. 

Public Class SampleWebSuccessAuditEvent
    Inherits System.Web.Management.WebSuccessAuditEvent
    Private customCreatedMsg, customRaisedMsg As String
    
    
    
    ' Invoked in case of events identified only by their event code.
    Public Sub New(ByVal msg As String, _
    ByVal eventSource As Object, ByVal eventCode As Integer)
        MyBase.New(msg, eventSource, eventCode)
        ' Perform custom initialization.
        customCreatedMsg = String.Format("Event created at: {0}", _
        DateTime.Now.TimeOfDay.ToString())

    End Sub
    
    
    ' Invoked in case of events identified by their event code.and 
    ' event detailed code.
    Public Sub New(ByVal msg As String, ByVal eventSource As Object, _
    ByVal eventCode As Integer, ByVal detailedCode As Integer)
        MyBase.New(msg, EventSource, eventCode, detailedCode)
        ' Perform custom initialization.
        customCreatedMsg = String.Format("Event created at: {0}", _
        DateTime.Now.TimeOfDay.ToString())

    End Sub
    
    
    
    ' Raises the SampleWebSuccessAuditEvent.
    Public Overrides Sub Raise() 
        ' Perform custom processing.
        customRaisedMsg = String.Format("Event raised at: {0}", _
        DateTime.Now.TimeOfDay.ToString())
        
        ' Raise the event.
        WebBaseEvent.Raise(Me)
    
    End Sub
    
    
    ' Obtains the current thread information.
    Public Function GetRequestInformation() As WebRequestInformation 
        ' No customization allowed.
        Return RequestInformation
    
    End Function 'GetRequestInformation
    
    
    'Formats Web request event information.
    'This method is invoked indirectly by the provider using one of the
    'overloaded ToString methods.
    Public Overrides Sub FormatCustomEventDetails(ByVal formatter _
    As WebEventFormatter)
        MyBase.FormatCustomEventDetails(formatter)

        ' Add custom data.
        formatter.AppendLine("")

        formatter.IndentationLevel += 1
        formatter.AppendLine("**SampleWebSuccessAuditEvent Start **")
        formatter.AppendLine(String.Format("Request path: {0}", _
        RequestInformation.RequestPath))
        formatter.AppendLine(String.Format("Request Url: {0}", _
        RequestInformation.RequestUrl))

        ' Display custom event timing.
        formatter.AppendLine(customCreatedMsg)
        formatter.AppendLine(customRaisedMsg)

        formatter.AppendLine("** SampleWebSuccessAuditEvent End **")

        formatter.IndentationLevel -= 1

    End Sub
End Class

Poniższy przykład to fragment pliku konfiguracji, który umożliwia ASP.NET monitorowanie kondycji w celu korzystania ze zdarzenia.

<healthMonitoring   
..enabled="true"  
..heartBeatInterval="0">   
  <providers>  
    <add name="EventLogProvider"   
    type="System.Web.Management.EventLogWebEventProvider,  
    System.Web,Version=2.0.3600.0,Culture=neutral,  
    PublicKeyToken=b03f5f7f11d50a3a"/>  
  </providers>  
  <eventMappings>  
    <add  name="SampleWebSuccessAuditEvent"   
      type="SamplesAspNet.SampleWebSuccessAuditEvent,  
      websuccessauditevent,Version=1.0.1663.31140,   
      Culture=neutral,   
      PublicKeyToken=0d1fa0f69d94de96,   
      processorArchitecture=MSIL"/>  
  </eventMappings>  
  <rules>  
    <add name="Custom Failure Audit Default"  
      eventName=" SampleWebFailureAuditEvent "  
      provider="EventLogProvider"  
      profile="Default"/>    
  </rules>  
</healthMonitoring>  

Uwagi

ASP.NET monitorowanie kondycji umożliwia pracownikom produkcyjnym i operacyjnym zarządzanie wdrożonych aplikacji internetowych. System.Web.Management Przestrzeń nazw zawiera typy zdarzeń kondycji odpowiedzialnych za pakowanie danych o stanie kondycji aplikacji i typów dostawców odpowiedzialnych za przetwarzanie tych danych. Zawiera również typy pomocnicze, które ułatwiają zarządzanie zdarzeniami kondycji.

Klasa WebSuccessAuditEvent jest używana w przypadku pomyślnej operacji związanej z zabezpieczeniami. Przykładem jest pomyślna autoryzacja adresu URL dla żądania sieci Web.

Na poniższej liście opisano funkcje, dla których zdarzenia typu WebSuccessAuditEvent są zgłaszane przez ASP.NET:

Gdy element WebSuccessAuditEvent zostanie zgłoszony, ASP.NET monitorowanie kondycji zwiększa powiązane zdarzenia powodzenia inspekcji podniesione licznik wydajności, a następnie sprawdza konfigurację, healthMonitoring aby określić, czy dostawcy subskrybują zdarzenie. Jeśli dostawcy subskrybują zdarzenie, ASP.NET wysyła do nich zdarzenie w celu przetworzenia.

Uwaga

Aby wyświetlić licznik wydajności Podniósł zdarzenie sukcesu inspekcji w monitorze systemu (PerfMon), w oknie Dodawanie liczników wybierz ASP.NET z listy rozwijanej Obiekt wydajności , wybierz licznik wydajności Zdarzenia powodzenia inspekcji, a następnie kliknij przycisk Dodaj . Aby uzyskać więcej informacji, zobacz Monitorowanie wydajności aplikacji ASP.NET.

Ponieważ inspekcje powodzenia reprezentują oczekiwany warunek, możesz nie chcieć ich subskrybować. Możesz je zasubskrybować, aby zapewnić inspekcję dostępu dla witryny.

Uwaga

W większości przypadków będzie można użyć ASP.NET typów monitorowania kondycji zgodnie z implementacją i będziesz kontrolować system monitorowania kondycji, określając wartości w healthMonitoring sekcji konfiguracji. Możesz również pochodzić z typów monitorowania kondycji, aby utworzyć własne niestandardowe zdarzenia i dostawców. Przykład wyprowadzania z klasy można znaleźć w przykładzie WebSuccessAuditEvent podanym w tym temacie.

Konstruktory

WebSuccessAuditEvent(String, Object, Int32)

Inicjuje WebSuccessAuditEvent nowe wystąpienie klasy przy użyciu podanych parametrów.

WebSuccessAuditEvent(String, Object, Int32, Int32)

Inicjuje WebSuccessAuditEvent nowe wystąpienie klasy przy użyciu podanych parametrów.

Właściwości

EventCode

Pobiera wartość kodu skojarzona ze zdarzeniem.

(Odziedziczone po WebBaseEvent)
EventDetailCode

Pobiera kod szczegółów zdarzenia.

(Odziedziczone po WebBaseEvent)
EventID

Pobiera identyfikator skojarzony ze zdarzeniem.

(Odziedziczone po WebBaseEvent)
EventOccurrence

Pobiera licznik reprezentujący liczbę przypadków wystąpienia zdarzenia.

(Odziedziczone po WebBaseEvent)
EventSequence

Pobiera liczbę przypadków zgłoszenia zdarzenia przez aplikację.

(Odziedziczone po WebBaseEvent)
EventSource

Pobiera obiekt, który zgłasza zdarzenie.

(Odziedziczone po WebBaseEvent)
EventTime

Pobiera czas zgłoszenia zdarzenia.

(Odziedziczone po WebBaseEvent)
EventTimeUtc

Pobiera czas zgłoszenia zdarzenia.

(Odziedziczone po WebBaseEvent)
Message

Pobiera komunikat opisujący zdarzenie.

(Odziedziczone po WebBaseEvent)
ProcessInformation

Pobiera informacje o ASP.NET procesie hostingu aplikacji.

(Odziedziczone po WebManagementEvent)
RequestInformation

Pobierz informacje skojarzone z żądaniem internetowym.

(Odziedziczone po WebAuditEvent)

Metody

Equals(Object)

Określa, czy dany obiekt jest taki sam, jak bieżący obiekt.

(Odziedziczone po Object)
FormatCustomEventDetails(WebEventFormatter)

Zapewnia standardowe formatowanie informacji o zdarzeniu.

(Odziedziczone po WebBaseEvent)
GetHashCode()

Służy jako domyślna funkcja skrótu.

(Odziedziczone po Object)
GetType()

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

(Odziedziczone po Object)
IncrementPerfCounters()

Zwiększa liczbę zgłoszonych liczników wydajności zdarzeń powodzenia inspekcji.

MemberwiseClone()

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

(Odziedziczone po Object)
Raise()

Zgłasza zdarzenie, powiadamiając każdego skonfigurowanego dostawcę o wystąpieniu zdarzenia.

(Odziedziczone po WebBaseEvent)
ToString()

Formatuje informacje o zdarzeniach do celów wyświetlania.

(Odziedziczone po WebBaseEvent)
ToString(Boolean, Boolean)

Formatuje informacje o zdarzeniach do celów wyświetlania.

(Odziedziczone po WebBaseEvent)

Dotyczy

Zobacz też