WebAuthenticationFailureAuditEvent Kelas
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Menyediakan informasi tentang kegagalan autentikasi ASP.NET.
public ref class WebAuthenticationFailureAuditEvent : System::Web::Management::WebFailureAuditEvent
public class WebAuthenticationFailureAuditEvent : System.Web.Management.WebFailureAuditEvent
type WebAuthenticationFailureAuditEvent = class
inherit WebFailureAuditEvent
Public Class WebAuthenticationFailureAuditEvent
Inherits WebFailureAuditEvent
- Warisan
-
WebAuthenticationFailureAuditEvent
Contoh
Contoh kode berikut menunjukkan cara menggunakan WebAuthenticationFailureAuditEvent kelas .
using System;
using System.Text;
using System.Web;
using System.Web.Management;
namespace SamplesAspNet
{
// Implements a custom WebAuthenticationFailureAuditEvent class.
public class SampleWebAuthenticationFailureAuditEvent :
System.Web.Management.WebAuthenticationFailureAuditEvent
{
private string customCreatedMsg, customRaisedMsg;
// Invoked in case of events identified only by
// their event code.
public SampleWebAuthenticationFailureAuditEvent(
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 SampleWebAuthenticationFailureAuditEvent(
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 SampleWebAuthenticationFailureAuditEvent.
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(
"* SampleWebAuthenticationFailureAuditEvent 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(
"* SampleWebAuthenticationFailureAuditEvent End *");
formatter.IndentationLevel -= 1;
}
}
}
Imports System.Text
Imports System.Web
Imports System.Web.Management
' Implements a custom WebAuthenticationFailureAuditEvent class.
Public Class SampleWebAuthenticationFailureAuditEvent
Inherits System.Web.Management.WebAuthenticationFailureAuditEvent
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 SampleWebAuthenticationFailureAuditEvent.
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( _
"* SampleWebAuthenticationFailureAuditEvent 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( _
"* SampleWebAuthenticationFailureAuditEvent End *")
formatter.IndentationLevel -= 1
End Sub
End Class
Keterangan
Daftar berikut ini menjelaskan fitur di mana WebAuthenticationFailureAuditEvent peristiwa dimunculkan secara default secara ASP.NET.
Catatan
Secara default ASP.NET dikonfigurasi untuk mencatat kondisi kegagalan audit saja, karena kondisi keberhasilan pengelogan dapat sangat mengganggu sumber daya sistem. Anda selalu dapat mengonfigurasi sistem untuk mencatat kondisi keberhasilan.
Autentikasi Formulir. Sementara audit keberhasilan menyertakan nama pengguna yang diautentikasi; audit kegagalan tidak menyertakan nama pengguna, karena biasanya dihasilkan dari tiket yang gagal didekripsi atau validasi. Keduanya berisi alamat IP klien. Kode audit peristiwa terkait adalah AuditFormsAuthenticationFailure.
Keanggotaan. Audit keberhasilan dan kegagalan berisi nama pengguna yang dicoba. Tidak ada bentuk audit yang akan berisi kata sandi yang dicoba, karena itu akan berisiko mempertahankan kata sandi yang valid di log. Kode audit peristiwa terkait adalah AuditMembershipAuthenticationFailure.
WebAuthenticationFailureAuditEvent Ketika dinaikkan, secara default memperbarui Peristiwa Kegagalan Autentikasi Audit Meningkatkan penghitung kinerja. Untuk melihat penghitung kinerja ini di Monitor Sistem (PerfMon), di jendela Tambahkan Penghitung pilih ASP.NET
di daftar drop-down Objek performa , pilih penghitung kinerja Peristiwa Kegagalan Autentikasi yang Dinaikkan , dan klik tombol Tambahkan . Untuk informasi selengkapnya, lihat Menggunakan Monitor Sistem (PerfMon) dengan aplikasi ASP.NET.
Catatan
Dalam kebanyakan kasus, Anda akan dapat menggunakan jenis pemantauan kesehatan ASP.NET seperti yang diterapkan, dan Anda akan mengontrol sistem pemantauan kesehatan dengan menentukan nilai di bagian healthMonitoring
konfigurasi. Anda juga dapat memperoleh dari jenis pemantauan kesehatan untuk membuat peristiwa dan penyedia kustom Anda sendiri. Untuk contoh turunan dari WebAuthenticationFailureAuditEvent kelas, lihat contoh yang disediakan dalam topik ini.
Konstruktor
WebAuthenticationFailureAuditEvent(String, Object, Int32, Int32, String) |
Menginisialisasi instans WebAuthenticationFailureAuditEvent baru kelas dengan parameter peristiwa yang ditentukan. |
WebAuthenticationFailureAuditEvent(String, Object, Int32, String) |
Menginisialisasi instans WebAuthenticationFailureAuditEvent baru kelas dengan parameter peristiwa yang ditentukan. |
Properti
EventCode |
Mendapatkan nilai kode yang terkait dengan peristiwa. (Diperoleh dari WebBaseEvent) |
EventDetailCode |
Mendapatkan kode detail peristiwa. (Diperoleh dari WebBaseEvent) |
EventID |
Mendapatkan pengidentifikasi yang terkait dengan peristiwa. (Diperoleh dari WebBaseEvent) |
EventOccurrence |
Mendapatkan penghitung yang menunjukkan berapa kali peristiwa terjadi. (Diperoleh dari WebBaseEvent) |
EventSequence |
Mendapatkan berapa kali peristiwa telah dinaikkan oleh aplikasi. (Diperoleh dari WebBaseEvent) |
EventSource |
Mendapatkan objek yang meningkatkan peristiwa. (Diperoleh dari WebBaseEvent) |
EventTime |
Mendapatkan waktu ketika acara dinaikkan. (Diperoleh dari WebBaseEvent) |
EventTimeUtc |
Mendapatkan waktu ketika acara dinaikkan. (Diperoleh dari WebBaseEvent) |
Message |
Mendapatkan pesan yang menjelaskan peristiwa. (Diperoleh dari WebBaseEvent) |
NameToAuthenticate |
Mendapatkan nama pengguna untuk diautentikasi. |
ProcessInformation |
Mendapatkan informasi tentang proses hosting aplikasi ASP.NET. (Diperoleh dari WebManagementEvent) |
RequestInformation |
Dapatkan informasi yang terkait dengan permintaan Web. (Diperoleh dari WebAuditEvent) |
Metode
Equals(Object) |
Menentukan apakah objek yang ditentukan sama dengan objek saat ini. (Diperoleh dari Object) |
FormatCustomEventDetails(WebEventFormatter) |
Menyediakan pemformatan standar informasi peristiwa. (Diperoleh dari WebBaseEvent) |
GetHashCode() |
Berfungsi sebagai fungsi hash default. (Diperoleh dari Object) |
GetType() |
Mendapatkan dari instans Type saat ini. (Diperoleh dari Object) |
IncrementPerfCounters() |
Menaikkan Peristiwa Kegagalan Audit Penghitung kinerja yang dinaikkan. (Diperoleh dari WebFailureAuditEvent) |
MemberwiseClone() |
Membuat salinan dangkal dari saat ini Object. (Diperoleh dari Object) |
Raise() |
Memunculkan peristiwa dengan memberi tahu penyedia yang dikonfigurasi bahwa peristiwa telah terjadi. (Diperoleh dari WebBaseEvent) |
ToString() |
Memformat informasi peristiwa untuk tujuan tampilan. (Diperoleh dari WebBaseEvent) |
ToString(Boolean, Boolean) |
Memformat informasi peristiwa untuk tujuan tampilan. (Diperoleh dari WebBaseEvent) |