WebAuditEventとは? わかりやすく解説

WebAuditEvent クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

すべての ASP.NET 状態監視監査イベントの基本クラスです。

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class WebAuditEvent
    Inherits WebManagementEvent
Dim instance As WebAuditEvent
public class WebAuditEvent : WebManagementEvent
public ref class WebAuditEvent : public
 WebManagementEvent
public class WebAuditEvent extends WebManagementEvent
public class WebAuditEvent extends
 WebManagementEvent
解説解説

運用および操作の担当者は、ASP.NET Health Monitoring を使用して、配置されている Web アプリケーションを管理できます。System.Web.Management 名前空間には、アプリケーションの状態データをパッケージ化する状態イベント型、およびそのデータを処理するプロバイダ型が含まれます。また、状態イベント管理を支援するサポート型も含まれます。

WebAuditEvent クラスは、ASP.NET Health Monitoring の監査イベント クラスの派生元である基本クラスです。監査イベントは、Web アプリケーションにおけるセキュリティ関連操作に関する情報を生成し、監査操作ごとに正常終了およびエラーの両方の情報を提供します。

ASP.NET Health Monitoring system は、正常終了のイベントもエラーのイベントもどちらも監査できます。つまり、通常および異常の両方の状態についてアプリケーションを監視できます。既定では、エラーの監査イベントだけが記録されます。

ASP.NET では次の操作が監査され、正常終了またはエラーの状態監視監査イベントが生成されます。

メモメモ

ほとんどの場合、ASP.NET 状態監視型は実装のまま使用でき、healthMonitoring 構成セクションに値を指定して ASP.NET Health Monitoring system を制御できます。状態監視型の派生として独自のイベントおよびプロバイダを作成することもできます。WebAuditEvent クラスの派生の例については、このトピックの例を参照してください。

継承時の注意 カスタム イベント情報を表示用に書式設定する場合は、ToString メソッドではなく、FormatCustomEventDetails メソッドをオーバーライドします。これにより、重要なシステム情報に対する上書きや不正な変更を防げます。

使用例使用例

WebAuditEvent クラスの派生としてカスタム監査イベントを作成する方法を次のコード例に示します。

Imports System
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 'New
    
    
    ' 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 'New
    
    ' 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 'Raise
    
    
    ' 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 'FormatCustomEventDetails
 
End Class 'SampleWebAuditEvent

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;

        }
    }

}

次に示すのは、ASP.NET でイベントを使用できるようにする構成ファイルの抜粋です。

<healthMonitoring 
  enabled="true"
  heartBeatInterval="0"> 

  <providers>
</healthMonitoring>
継承階層継承階層
System.Object
   System.Web.Management.WebBaseEvent
     System.Web.Management.WebManagementEvent
      System.Web.Management.WebAuditEvent
         System.Web.Management.WebFailureAuditEvent
         System.Web.Management.WebSuccessAuditEvent
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebAuditEvent メンバ
System.Web.Management 名前空間
WebManagementEvent
WebFailureAuditEvent
WebAuthenticationFailureAuditEvent
WebSuccessAuditEvent
WebAuthenticationSuccessAuditEvent
WebViewStateFailureAuditEvent
WebEventCodes
その他の技術情報
healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebAuditEvent コンストラクタ (String, Object, Int32, Int32)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

イベント パラメータを指定して、WebAuditEvent クラスの新しいインスタンスを初期化します。

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Friend Sub New
 ( _
    message As String, _
    eventSource As Object, _
    eventCode As Integer, _
    eventDetailCode As Integer _
)
Dim message As String
Dim eventSource As Object
Dim eventCode As Integer
Dim eventDetailCode As Integer

Dim instance As New WebAuditEvent(message,
 eventSource, eventCode, eventDetailCode)
protected internal WebAuditEvent (
    string message,
    Object eventSource,
    int eventCode,
    int eventDetailCode
)
protected public:
WebAuditEvent (
    String^ message, 
    Object^ eventSource, 
    int eventCode, 
    int eventDetailCode
)
protected WebAuditEvent (
    String message, 
    Object eventSource, 
    int eventCode, 
    int eventDetailCode
)
protected internal function
 WebAuditEvent (
    message : String, 
    eventSource : Object, 
    eventCode : int, 
    eventDetailCode : int
)

パラメータ

message

イベントの説明。

eventSource

イベントのソースであるオブジェクト。

eventCode

イベントに関連付けられているコード。カスタム イベントを実装する場合、イベント コードを WebExtendedBase より大きくする必要があります。

eventDetailCode

イベントの詳細な識別子を指定する WebEventCodes 値。

解説解説
使用例使用例

このコンストラクタを呼び出すコードの例を次に示します。このコード例は、WebAuditEvent クラスのトピックで取り上げているコード例の一部分です。

' 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 'New

// 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());
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebAuditEvent クラス
WebAuditEvent メンバ
System.Web.Management 名前空間

WebAuditEvent コンストラクタ (String, Object, Int32)

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

指定されたパラメータを使用して、WebAuditEvent クラスの新しいインスタンスを初期化します。

名前空間: System.Web.Management
アセンブリ: System.Web (system.web.dll 内)
構文構文

Protected Friend Sub New
 ( _
    message As String, _
    eventSource As Object, _
    eventCode As Integer _
)
Dim message As String
Dim eventSource As Object
Dim eventCode As Integer

Dim instance As New WebAuditEvent(message,
 eventSource, eventCode)
protected internal WebAuditEvent (
    string message,
    Object eventSource,
    int eventCode
)
protected public:
WebAuditEvent (
    String^ message, 
    Object^ eventSource, 
    int eventCode
)
protected WebAuditEvent (
    String message, 
    Object eventSource, 
    int eventCode
)
protected internal function
 WebAuditEvent (
    message : String, 
    eventSource : Object, 
    eventCode : int
)

パラメータ

message

イベントの説明。

eventSource

イベントのソースであるオブジェクト。

eventCode

イベントに関連付けられているコード。カスタム イベントを実装する場合、イベント コードを WebExtendedBase より大きくする必要があります。

解説解説
使用例使用例

このコンストラクタを呼び出すコードの例を次に示します。このコード例は、WebAuditEvent クラスのトピックで取り上げているコード例の一部分です。

' 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 'New

// 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());
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebAuditEvent クラス
WebAuditEvent メンバ
System.Web.Management 名前空間

WebAuditEvent コンストラクタ


オーバーロードの一覧オーバーロードの一覧

参照参照

関連項目

WebAuditEvent クラス
WebAuditEvent メンバ
System.Web.Management 名前空間

WebAuditEvent プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ ApplicationInformation  監視中の現在のアプリケーションに関する情報を格納している WebApplicationInformation オブジェクトを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventCode  イベントに関連付けられているコード値を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventDetailCode  イベント詳細コードを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventID  イベントに関連付けられている識別子を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventOccurrence  イベントが発生した回数を表すカウンタを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventSequence  アプリケーションによるイベントの発生回数を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventSource  イベントを発生させるオブジェクトを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventTime  イベントが発生した時刻を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ EventTimeUtc  イベントが発生した時刻を取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ Message  イベントを説明するメッセージを取得します。 ( WebBaseEvent から継承されます。)
パブリック プロパティ ProcessInformation  ASP.NET アプリケーション ホスト プロセスに関する情報を取得します。 ( WebManagementEvent から継承されます。)
パブリック プロパティ RequestInformation Web 要求に関連付けられた情報を取得します。
参照参照

関連項目

WebAuditEvent クラス
System.Web.Management 名前空間
WebManagementEvent
WebFailureAuditEvent
WebAuthenticationFailureAuditEvent
WebSuccessAuditEvent
WebAuthenticationSuccessAuditEvent
WebViewStateFailureAuditEvent
WebEventCodes

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebAuditEvent メソッド


パブリック メソッドパブリック メソッド

プロテクト メソッドプロテクト メソッド
参照参照

関連項目

WebAuditEvent クラス
System.Web.Management 名前空間
WebManagementEvent
WebFailureAuditEvent
WebAuthenticationFailureAuditEvent
WebSuccessAuditEvent
WebAuthenticationSuccessAuditEvent
WebViewStateFailureAuditEvent
WebEventCodes

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視

WebAuditEvent メンバ

すべての ASP.NET 状態監視監査イベントの基本クラスです。

WebAuditEvent データ型で公開されるメンバを以下の表に示します。


プロテクト コンストラクタプロテクト コンストラクタ
  名前 説明
プロテクト メソッド WebAuditEvent オーバーロードされます。  
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ ApplicationInformation  監視中の現在のアプリケーションに関する情報を格納している WebApplicationInformation オブジェクトを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventCode  イベントに関連付けられているコード値を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventDetailCode  イベント詳細コードを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventID  イベントに関連付けられている識別子を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventOccurrence  イベントが発生した回数を表すカウンタを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventSequence  アプリケーションによるイベントの発生回数を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventSource  イベントを発生させるオブジェクトを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventTime  イベントが発生した時刻を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ EventTimeUtc  イベントが発生した時刻を取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ Message  イベントを説明するメッセージを取得します。(WebBaseEvent から継承されます。)
パブリック プロパティ ProcessInformation  ASP.NET アプリケーション ホスト プロセスに関する情報を取得します。(WebManagementEvent から継承されます。)
パブリック プロパティ RequestInformation Web 要求に関連付けられた情報を取得します。
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

WebAuditEvent クラス
System.Web.Management 名前空間
WebManagementEvent
WebFailureAuditEvent
WebAuthenticationFailureAuditEvent
WebSuccessAuditEvent
WebAuthenticationSuccessAuditEvent
WebViewStateFailureAuditEvent
WebEventCodes

その他の技術情報

healthMonitoring 要素 (ASP.NET 設定スキーマ)
ASP.NET の状態監視



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「WebAuditEvent」の関連用語

WebAuditEventのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebAuditEventのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS