次の方法で共有


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

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

次に、構成ファイルの セクションと eventMappings セクションのprovider抜粋を示します。 これらは既定で既に設定されています。 行う必要があるのは、 セクションの healthMonitoring 要素のセットアップをrules提供することだけです。

<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名前空間には、アプリケーションの正常性状態データのパッケージ化を担当する正常性イベントの種類と、このデータの処理を担当するプロバイダーの種類が含まれています。 また、正常性イベントの管理中に役立つサポート型も含まれています。

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

Note

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

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

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

WebAuthenticationSuccessAuditEventが発生すると、既定で Authentication Success Events Raised パフォーマンス カウンターが更新されます。 このパフォーマンス カウンターをシステム モニター (PerfMon) で表示するには、[カウンターの追加] ウィンドウで、[パフォーマンス オブジェクト] ドロップダウン リストで [ASP.NET] を選択し、[Authentication Success Events Raised]\(認証成功イベント発生パフォーマンス カウンター\) を選択し、[追加] ボタンをクリックします。 詳細については、「 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)

適用対象

こちらもご覧ください