WebAuditEvent 클래스

정의

모든 ASP.NET 상태 모니터링 감사 이벤트의 기본 클래스 역할을 합니다.

public ref class WebAuditEvent : System::Web::Management::WebManagementEvent
public class WebAuditEvent : System.Web.Management.WebManagementEvent
type WebAuditEvent = class
    inherit WebManagementEvent
Public Class WebAuditEvent
Inherits WebManagementEvent
상속
파생

예제

다음 코드 예제에서는 클래스에서 WebAuditEvent 파생하여 사용자 지정 감사 이벤트를 만드는 방법을 보여줍니다.


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

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

        // Invoked in case of events identified only by their event code.
        public SampleWebAuditEvent(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 SampleWebAuditEvent(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 SampleWebAuditEvent.
        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()
        {
            // Obtain the Web request information.
            // No customization is allowed here.
            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(
                "******** SampleWebAuditEvent Information 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(
                "******** SampleWebAuditEvent Information End ********");

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


' Implements a custom WebAuditEvent class. 

Public Class SampleWebAuditEvent
    Inherits System.Web.Management.WebAuditEvent
    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 SampleWebAuditEvent.
    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 
        ' Obtain the Web request information.
        ' No customization is allowed here.
        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("******** SampleWebAuditEvent Information 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("******** SampleWebAuditEvent Information End ********")
        
        formatter.IndentationLevel -= 1
    
    End Sub
End Class

다음은 ASP.NET 이벤트를 사용할 수 있도록 하는 구성 파일의 발췌입니다.

<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="SampleWebAuditEvent"
      type="SamplesAspNet.SampleWebAuditEvent,
      webauditevent,Version=1.0.1663.31140,
      Culture=neutral,
      PublicKeyToken=0d1fa0f69d94de96,
      processorArchitecture=MSIL"/>
  </eventMappings>

  <rules>
    <add name="Custom Audit Default"
      eventName="SampleWebAuditEvent"
      provider="EventLogProvider"
      profile="Default"/>
  </rules>

</healthMonitoring>

설명

ASP.NET 상태 모니터링을 사용하면 프로덕션 및 운영 직원이 배포된 웹 애플리케이션을 관리할 수 있습니다. 네임스페이스에는 System.Web.Management 애플리케이션 상태 데이터 패키징을 담당하는 상태 이벤트 유형과 이 데이터 처리를 담당하는 공급자 유형이 포함됩니다. 또한 상태 이벤트를 관리하는 동안 도움이 되는 지원 유형도 포함합니다.

WebAuditEvent 클래스는 ASP.NET 상태 모니터링 감사 이벤트 클래스가 파생되는 기본 클래스입니다. 감사 이벤트는 웹 애플리케이션에서 보안 관련 작업에 대한 정보를 생성하고 감사된 각 작업에 대한 성공 및 실패 이벤트를 모두 제공합니다.

상태 모니터링 시스템은 성공 이벤트와 실패한 이벤트를 모두 감사할 수 있습니다. 즉, 정상 및 오작동 상태 모두에 대해 애플리케이션을 모니터링할 수 있습니다. 기본적으로 오류 감사 이벤트만 기록됩니다.

다음 작업은 ASP.NET 의해 감사되며 성공 또는 실패 상태 모니터링 감사 이벤트를 생성할 수 있습니다.

  • ASP.NET 애플리케이션 사용자가 시도한 로그인 시도입니다. 이 감사에 대한 자세한 내용은 다음을 참조 WebAuthenticationSuccessAuditEvent 하세요 WebSuccessAuditEvent.

  • 인증 실패, 실패한 리소스 액세스 시도 및 기타 보안 관련 이벤트와 같은 보안 관련 이벤트입니다. 이러한 이벤트의 로그는 애플리케이션에 대한 침입 또는 공격을 조사할 때 유용할 수 있습니다. 기본적으로 익명 사용자의 권한 부여 실패에 대한 감사 지원은 제공되지 않습니다. 오류 이벤트 감사에 대한 자세한 내용은 다음을 참조 WebAuthenticationFailureAuditEvent 하세요 WebFailureAuditEvent.

  • ASP.NET 애플리케이션에서 발생하는 사용자 지정 이벤트입니다. 클래스 및 파생 클래스에서 제공하는 기능을 확장하여 사용자 지정 이벤트를 감사할 WebAuditEvent 수 있습니다.

메모

대부분의 경우 구현된 ASP.NET 상태 모니터링 유형을 사용할 수 있으며 healthMonitoring 구성 섹션에서 값을 지정하여 상태 모니터링 시스템을 제어합니다. 상태 모니터링 형식에서 파생하여 고유한 사용자 지정 이벤트 및 공급자를 만들 수도 있습니다. 클래스에서 파생되는 예제는 WebAuditEvent 이 항목에 제공된 예제를 참조하세요.

상속자 참고

표시할 사용자 지정 이벤트 정보의 서식을 지정할 때 메서드 대신 메서드를 재정의 FormatCustomEventDetails(WebEventFormatter)ToString 합니다. 이렇게 하면 중요한 시스템 정보를 덮어쓰거나 변조하지 않습니다.

생성자

Name Description
WebAuditEvent(String, Object, Int32, Int32)

지정된 이벤트 매개 변수를 사용하여 클래스의 WebAuditEvent 새 인스턴스를 초기화합니다.

WebAuditEvent(String, Object, Int32)

제공된 매개 변수를 사용하여 클래스의 WebAuditEvent 새 인스턴스를 초기화합니다.

속성

Name Description
EventCode

이벤트와 연결된 코드 값을 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventDetailCode

이벤트 세부 정보 코드를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventID

이벤트와 연결된 식별자를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventOccurrence

이벤트가 발생한 횟수를 나타내는 카운터를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventSequence

애플리케이션에서 이벤트가 발생한 횟수를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventSource

이벤트를 발생시키는 개체를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventTime

이벤트가 발생한 시간을 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
EventTimeUtc

이벤트가 발생한 시간을 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
Message

이벤트를 설명하는 메시지를 가져옵니다.

(다음에서 상속됨 WebBaseEvent)
ProcessInformation

ASP.NET 애플리케이션 호스팅 프로세스에 대한 정보를 가져옵니다.

(다음에서 상속됨 WebManagementEvent)
RequestInformation

웹 요청과 연결된 정보를 가져옵니다.

메서드

Name Description
Equals(Object)

지정된 개체가 현재 개체와 같은지 여부를 확인합니다.

(다음에서 상속됨 Object)
FormatCustomEventDetails(WebEventFormatter)

이벤트 정보의 표준 서식을 제공합니다.

(다음에서 상속됨 WebBaseEvent)
GetHashCode()

기본 해시 함수로 사용됩니다.

(다음에서 상속됨 Object)
GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
IncrementPerfCounters()

성능 카운터를 증가시키려면 내부적으로 사용됩니다.

(다음에서 상속됨 WebBaseEvent)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
Raise()

구성된 공급자에게 이벤트가 발생했음을 알려 이벤트를 발생합니다.

(다음에서 상속됨 WebBaseEvent)
ToString()

표시를 위해 이벤트 정보의 형식을 지정합니다.

(다음에서 상속됨 WebBaseEvent)
ToString(Boolean, Boolean)

표시를 위해 이벤트 정보의 형식을 지정합니다.

(다음에서 상속됨 WebBaseEvent)

적용 대상

추가 정보