言語

WebAuthenticationSuccessAuditEvent クラス

定義

成功した認証イベントに関する情報を提供します。

public ref class WebAuthenticationSuccessAuditEvent : System::Web::Management::WebSuccessAuditEvent
public class WebAuthenticationSuccessAuditEvent : System.Web.Management.WebSuccessAuditEvent
type WebAuthenticationSuccessAuditEvent = class
    inherit WebSuccessAuditEvent
Public Class WebAuthenticationSuccessAuditEvent
Inherits WebSuccessAuditEvent
継承

このコード例には、構成ファイルの抜粋と、 WebAuthenticationSuccessAuditEvent イベントをカスタマイズする方法を示すコードの 2 つの部分があります。

構成ファイルの providereventMappings セクションの抜粋を次に示します。 既定では既に設定されています。 実行する必要があるのは、rules セクションで healthMonitoring 要素の設定を指定することだけです。

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

    <providers>
      // Configure the provider to process
      // the health events.
      <add name="EventLogProvider"
         type="System.Web.Management.EventLogWebEventProvider,
         System.Web,Version=2.0.3600.0,Culture=neutral,
         PublicKeyToken=b03f5f7f11d50a3a"/>
    </providers>

    <eventMappings>
       <clear />
       // Configure the custom event
       // to handle the audit events.
        <add name="SampleWebAuthenticationSuccessAuditEvent"
          type="SamplesAspNet.SampleWebAuthenticationSuccessAuditEvent,
          webauthsuccessaudit, Version=1.0.1735.23144, Culture=neutral,
          PublicKeyToken=dd969eda3f3f6ae1, processorArchitecture=MSIL" />

     </eventMappings>
     <rules>
       <clear/>
       // Establish the connection between custom event
       // and the provider that must process it.
      <add name="Log Authentication Success Audits"
        eventName="SampleWebAuthenticationFailureAuditEvent"
        provider="EventLogProvider"
        profile="Custom" />\
     </rules>

</healthMonitoring>

次のコードは、 WebAuthenticationSuccessAuditEvent イベントをカスタマイズする方法を示しています。


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

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

        // Invoked in case of events identified only by their event code.
        public SampleWebAuthenticationSuccessAuditEvent(
            string msg, object eventSource, 
            int eventCode, string userName):
        base(msg, eventSource, eventCode, userName)
        {
            // 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 SampleWebAuthenticationSuccessAuditEvent(
            string msg, object eventSource,
            int eventCode, int detailedCode, string userName):
        base(msg, eventSource, eventCode, detailedCode, userName)
        {
            // Perform custom initialization.
            customCreatedMsg =
            string.Format("Event created at: {0}",
                DateTime.Now.TimeOfDay.ToString());
        }


        // Raises the SampleWebAuthenticationSuccessAuditEvent.
        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 is 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(
                "* SampleWebAuthenticationSuccessAuditEvent 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(
                "* SampleWebAuthenticationSuccessAuditEvent End *");

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


' Implements a custom WebAuthenticationSuccessAuditEvent class. 

Public Class SampleWebAuthenticationSuccessAuditEvent
    Inherits System.Web.Management.WebAuthenticationSuccessAuditEvent
    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, _
    ByVal userName As String)
        MyBase.New(msg, eventSource, eventCode, userName)
        ' 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, _
    ByVal userName As String)
        MyBase.New(msg, eventSource, eventCode, _
        detailedCode, userName)
        ' Perform custom initialization.
        customCreatedMsg = _
        String.Format( _
        "Event created at: {0}", _
        DateTime.Now.TimeOfDay.ToString())

    End Sub
    
    
    
    ' Raises the SampleWebAuthenticationSuccessAuditEvent.
    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 is 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( _
        "* SampleWebAuthenticationSuccessAuditEvent 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( _
        "* SampleWebAuthenticationSuccessAuditEvent End *")

        formatter.IndentationLevel -= 1

    End Sub
End Class

注釈

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

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

Note

既定では、ASP.NET は監査エラーの状態のみをログに記録するように構成されています。ログ記録の成功条件はシステム リソースに深刻な負担をかける可能性があります。 成功条件をログに記録するようにシステムはいつでも構成できます。

  • フォーム認証。 成功した条件が監査されます。 成功監査には、認証されたユーザー名が含まれます。 代わりに、失敗の監査にはユーザー名は含まれません。通常は、暗号化解除または検証に失敗したチケットが原因であるためです。 両方にクライアント IP アドレスが含まれています。 関連するイベント監査コードが AuditFormsAuthenticationSuccess

  • 会員権 成功した条件が監査されます。 成功と失敗の両方の監査には、試行されたユーザー名が含まれています。 どちらの形式の監査にも、試行されたパスワードは含まれないため、ログに有効なパスワードが保持されるリスクがあるためです。 関連するイベント監査コードが AuditMembershipAuthenticationSuccess

WebAuthenticationSuccessAuditEventが発生すると、既定で認証成功イベント発生パフォーマンス カウンターが更新されます。 システム モニター (PerfMon) でこのパフォーマンス カウンターを表示するには、追加カウンター ウィンドウで、Performance オブジェクトドロップダウン リストで ASP.NET を選択します。 認証成功イベント発生パフォーマンス カウンターを選択し、Add ボタンをクリックします。 詳細については、「 ASP.NET アプリケーションでのシステム モニター (PerfMon) の使用を参照してください。

Note

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

コンストラクター

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

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

WebAuthenticationSuccessAuditEvent(String, Object, Int32, String)

指定されたパラメーターを使用して、 WebAuthenticationSuccessAuditEvent クラスを初期化します。

プロパティ

名前 説明
EventCode

イベントに関連付けられているコード値を取得します。

(継承元 WebBaseEvent)
EventDetailCode

イベントの詳細コードを取得します。

(継承元 WebBaseEvent)
EventID

イベントに関連付けられている識別子を取得します。

(継承元 WebBaseEvent)
EventOccurrence

イベントが発生した回数を表すカウンターを取得します。

(継承元 WebBaseEvent)
EventSequence

アプリケーションによってイベントが発生した回数を取得します。

(継承元 WebBaseEvent)
EventSource

イベントを発生させるオブジェクトを取得します。

(継承元 WebBaseEvent)
EventTime

イベントが発生した時刻を取得します。

(継承元 WebBaseEvent)
EventTimeUtc

イベントが発生した時刻を取得します。

(継承元 WebBaseEvent)
Message

イベントを説明するメッセージを取得します。

(継承元 WebBaseEvent)
NameToAuthenticate

認証されたユーザーの名前を取得します。

ProcessInformation

ASP.NET アプリケーション ホスティング プロセスに関する情報を取得します。

(継承元 WebManagementEvent)
RequestInformation

Web 要求に関連付けられている情報を取得します。

(継承元 WebAuditEvent)

メソッド

名前 説明
Equals(Object)

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

(継承元 Object)
FormatCustomEventDetails(WebEventFormatter)

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

(継承元 WebBaseEvent)
GetHashCode()

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

(継承元 Object)
GetType()

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

(継承元 Object)
IncrementPerfCounters()

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

(継承元 WebSuccessAuditEvent)
MemberwiseClone()

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

(継承元 Object)
Raise()

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

(継承元 WebBaseEvent)
ToString()

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

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

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

(継承元 WebBaseEvent)

適用対象

こちらもご覧ください