次の方法で共有


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 パフォーマンス カウンターを表示するには、[カウンターの追加] ウィンドウで[パフォーマンス オブジェクト] ドロップダウン リストから [ASP.NET] を選択し、[Audit Success Event Raised]\(成功イベント発生の監査\) パフォーマンス カウンターを選択し、[追加] ボタンをクリックします。 詳細については、「 アプリケーション のパフォーマンス ASP.NET 監視」を参照してください。

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

Note

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

コンストラクター

WebSuccessAuditEvent(String, Object, Int32)

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

WebSuccessAuditEvent(String, Object, Int32, 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)

適用対象

こちらもご覧ください