WebSuccessAuditEvent クラス

定義

成功したセキュリティ イベントに関する情報を提供します。

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
継承
派生

次のコード例は、 WebSuccessAuditEvent クラスから派生してカスタム監査イベントを作成する方法を示しています。


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

次の例は、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="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>

注釈

ASP.NET 正常性の監視により、運用スタッフと運用スタッフはデプロイされた Web アプリケーションを管理できます。 System.Web.Management名前空間には、アプリケーションの正常性状態データをパッケージ化する正常性イベントの種類と、このデータの処理を担当するプロバイダーの種類が含まれています。 また、正常性イベントの管理中に役立つサポート型も含まれています。

WebSuccessAuditEvent クラスは、セキュリティ関連の操作が成功したときに使用されます。 この例は、Web 要求の URL 承認が成功した場合です。

次の一覧では、WebSuccessAuditEvent 型のイベントが ASP.NET によって発生する機能について説明します。

  • ファイルの承認。 成功した条件が監査されます。 ファイルの承認は、Windows ID が要求に関連付けられている場合にのみ、ASP.NET によって試行されます。 関連するイベント監査コードが AuditFileAuthorizationSuccess

  • URL 承認。 これは、承認が付与されている URL リソースへのアクセスを示します。 成功した条件が監査されます。 関連するイベント監査コードが AuditUrlAuthorizationSuccess

  • その他のセキュリティ条件。 関連するイベント コードの一覧を次に示します。

WebSuccessAuditEventが発生すると、正常性監視 ASP.NET 関連する Audit Success Events Raised パフォーマンス カウンターがインクリメントされ、healthMonitoring 構成がチェックされて、プロバイダーがイベントをサブスクライブしているかどうかを判断します。 プロバイダーがイベントをサブスクライブしている場合、ASP.NET は処理のためにイベントをディスパッチします。

Note

システム モニター (PerfMon) の Audit Success Event Raised パフォーマンス カウンターを表示するには、[追加カウンター] ウィンドウの [Performance オブジェクト> ドロップダウン リストから ASP.NET を選択します。 Audit Success Event Raised パフォーマンス カウンターを選択します。 をクリックし、Add ボタンをクリックします。 詳細については、「Monitoring ASP.NET Application Performance」を参照してください。

成功監査は予想される条件を表しているため、それらをサブスクライブしたくない場合があります。 サイトのアクセス監査を提供するために、それらをサブスクライブできます。

Note

ほとんどの場合、実装されている ASP.NET の正常性監視の種類を使用でき、healthMonitoring 構成セクションの値を指定して正常性監視システムを制御します。 正常性監視の種類から派生して、独自のカスタム イベントとプロバイダーを作成することもできます。 WebSuccessAuditEvent クラスから派生する例については、このトピックの例を参照してください。

コンストラクター

名前 説明
WebSuccessAuditEvent(String, Object, Int32, Int32)

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

WebSuccessAuditEvent(String, Object, Int32)

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

プロパティ

名前 説明
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)

メソッド

名前 説明
Equals(Object)

指定したオブジェクトが現在のオブジェクトと等しいかどうかを判断します。

(継承元 Object)
FormatCustomEventDetails(WebEventFormatter)

イベント情報の標準書式を提供します。

(継承元 WebBaseEvent)
GetHashCode()

既定のハッシュ関数として機能します。

(継承元 Object)
GetType()

現在のインスタンスの Type を取得します。

(継承元 Object)
IncrementPerfCounters()

Audit Success Events Raised パフォーマンス カウンターをインクリメントします。

MemberwiseClone()

現在の Objectの簡易コピーを作成します。

(継承元 Object)
Raise()

イベントが発生したことを構成済みのプロバイダーに通知することによって、イベントを発生させます。

(継承元 WebBaseEvent)
ToString()

表示目的でイベント情報を書式設定します。

(継承元 WebBaseEvent)
ToString(Boolean, Boolean)

表示目的でイベント情報を書式設定します。

(継承元 WebBaseEvent)

適用対象

こちらもご覧ください