Aracılığıyla paylaş


WebAuthenticationSuccessAuditEvent Sınıf

Tanım

Başarılı kimlik doğrulama olayları hakkında bilgi sağlar.

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
Devralma

Örnekler

Bu kod örneğinin iki bölümü vardır: yapılandırma dosyası alıntısı ve ardından olayın nasıl özelleştirildiğini WebAuthenticationSuccessAuditEvent gösteren kod.

Aşağıda yapılandırma dosyasının provider ve eventMappings bölümlerinin bir alıntısı yer almaktadır. Bunlar zaten varsayılan olarak ayarlanmıştır. Yapmanız gereken tek şey, bölümündeki öğenin kurulumunu rules sağlamaktır 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>  

Aşağıdaki kodda olayın nasıl özelleştirileceği gösterilmektedir 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

Açıklamalar

ASP.NET sistem durumu izleme, üretim ve operasyon personelinin dağıtılan Web uygulamalarını yönetmesine olanak tanır. Ad alanı, System.Web.Management uygulama sistem durumu verilerini paketlemeden sorumlu sistem durumu olay türlerini ve bu verileri işlemeden sorumlu sağlayıcı türlerini içerir. Ayrıca, sistem durumu olaylarının yönetimi sırasında yardımcı olan destekleyici türler de içerir.

Aşağıdaki listede, ASP.NET türünde WebAuthenticationSuccessAuditEventolayları tetikleyen özellikler açıklanmaktadır.

Not

Varsayılan olarak ASP.NET yalnızca denetim hatası koşullarını günlüğe kaydedecek şekilde yapılandırılır çünkü günlüğe kaydetme başarı koşulları sistem kaynaklarını ciddi ölçüde zorlayabilir. Sistemi her zaman başarı koşullarını günlüğe kaydedecek şekilde yapılandırabilirsiniz.

  • Forms Kimlik Doğrulaması. Başarılı koşullar denetleniyor. Başarılı denetimler, kimliği doğrulanmış kullanıcı adını içerir. Bunun yerine, genellikle şifre çözme veya doğrulamada başarısız olan bir anahtardan kaynaklanan hata denetimleri kullanıcı adını içermez. her ikisi de istemci IP adresini içerir. İlgili olay denetim kodu şeklindedir AuditFormsAuthenticationSuccess.

  • Üyelik. Başarılı koşullar denetleniyor. Hem başarı hem de başarısızlık denetimleri, denenen kullanıcı adını içerir. Her iki denetim biçimi de denenen parolayı içermez çünkü bu, günlükte geçerli bir parolanın kalıcı olmasını riske atacaktır. İlgili olay denetim kodu şeklindedir AuditMembershipAuthenticationSuccess.

bir WebAuthenticationSuccessAuditEvent tetiklendiğinde, varsayılan olarak Kimlik Doğrulama Başarılı Olayları Yükseltilmiş performans sayacını güncelleştirir. Bu performans sayacını Sistem İzleyicisi'nde (PerfMon) görüntülemek için, Sayaç Ekle penceresinde Performans nesnesi açılan listesinden ASP.NET seçin, Kimlik Doğrulaması Başarı Olayları Yükseltilmiş performans sayacını seçin ve Ekle düğmesine tıklayın. Daha fazla bilgi için bkz. ASP.NET Uygulamaları ile Sistem İzleyicisi'ni (PerfMon) kullanma.

Not

Çoğu durumda, uygulanan ASP.NET sistem durumu izleme türlerini kullanabilir ve yapılandırma bölümünde değerleri healthMonitoring belirterek sistem durumu izleme sistemini denetleyebilirsiniz. Kendi özel olaylarınızı ve sağlayıcılarınızı oluşturmak için sistem durumu izleme türlerinden de türetebilirsiniz. sınıfından türetme WebBaseEvent örneği için bu konuda sağlanan örne bakın.

Oluşturucular

WebAuthenticationSuccessAuditEvent(String, Object, Int32, Int32, String)

WebSuccessAuditEvent Sağlanan parametreleri kullanarak sınıfı başlatır.

WebAuthenticationSuccessAuditEvent(String, Object, Int32, String)

WebAuthenticationSuccessAuditEvent Sağlanan parametreleri kullanarak sınıfı başlatır.

Özellikler

EventCode

Olayla ilişkili kod değerini alır.

(Devralındığı yer: WebBaseEvent)
EventDetailCode

Olay ayrıntı kodunu alır.

(Devralındığı yer: WebBaseEvent)
EventID

Olayla ilişkili tanımlayıcıyı alır.

(Devralındığı yer: WebBaseEvent)
EventOccurrence

Olayın kaç kez gerçekleştiğini gösteren bir sayaç alır.

(Devralındığı yer: WebBaseEvent)
EventSequence

Olayın uygulama tarafından kaç kez tetiklendiğini alır.

(Devralındığı yer: WebBaseEvent)
EventSource

Olayı oluşturan nesneyi alır.

(Devralındığı yer: WebBaseEvent)
EventTime

Olayın tetiklendiği zamanı alır.

(Devralındığı yer: WebBaseEvent)
EventTimeUtc

Olayın tetiklendiği zamanı alır.

(Devralındığı yer: WebBaseEvent)
Message

Olayı açıklayan iletiyi alır.

(Devralındığı yer: WebBaseEvent)
NameToAuthenticate

Kimliği doğrulanmış kullanıcının adını alır.

ProcessInformation

ASP.NET uygulama barındırma işlemi hakkında bilgi alır.

(Devralındığı yer: WebManagementEvent)
RequestInformation

Web isteğiyle ilişkili bilgileri alın.

(Devralındığı yer: WebAuditEvent)

Yöntemler

Equals(Object)

Belirtilen nesnenin geçerli nesneye eşit olup olmadığını belirler.

(Devralındığı yer: Object)
FormatCustomEventDetails(WebEventFormatter)

Olay bilgilerinin standart biçimlendirmesini sağlar.

(Devralındığı yer: WebBaseEvent)
GetHashCode()

Varsayılan karma işlevi işlevi görür.

(Devralındığı yer: Object)
GetType()

Type Geçerli örneğini alır.

(Devralındığı yer: Object)
IncrementPerfCounters()

Denetim Başarısı Olayları Yükseltilmiş performans sayacını artırır.

(Devralındığı yer: WebSuccessAuditEvent)
MemberwiseClone()

Geçerli Objectöğesinin sığ bir kopyasını oluşturur.

(Devralındığı yer: Object)
Raise()

Yapılandırılmış sağlayıcılara olayın gerçekleştiğini bildirerek bir olayı tetikler.

(Devralındığı yer: WebBaseEvent)
ToString()

Olay bilgilerini görüntüleme amacıyla biçimlendirin.

(Devralındığı yer: WebBaseEvent)
ToString(Boolean, Boolean)

Olay bilgilerini görüntüleme amacıyla biçimlendirin.

(Devralındığı yer: WebBaseEvent)

Şunlara uygulanır

Ayrıca bkz.