WebErrorEvent 构造函数

定义

初始化 WebErrorEvent 类的新实例。

重载

WebErrorEvent(String, Object, Int32, Exception)

使用所提供的参数初始化 WebErrorEvent 类。

WebErrorEvent(String, Object, Int32, Int32, Exception)

使用所提供的参数初始化 WebErrorEvent 类的新实例。

WebErrorEvent(String, Object, Int32, Exception)

使用所提供的参数初始化 WebErrorEvent 类。

protected public:
 WebErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, Exception ^ exception);
protected internal WebErrorEvent (string message, object eventSource, int eventCode, Exception exception);
new System.Web.Management.WebErrorEvent : string * obj * int * Exception -> System.Web.Management.WebErrorEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, exception As Exception)

参数

message
String

事件说明。

eventSource
Object

作为事件源的对象。

eventCode
Int32

与该事件关联的代码。 实现自定义事件时,事件代码必须大于 WebExtendedBase

exception
Exception

与此错误关联的 Exception

示例

下面的代码示例演示如何自定义此构造函数。

// Invoked in case of events identified 
// only by their event code.
public SampleWebErrorEvent(string msg, 
    object eventSource, int eventCode, Exception e)
    :
base(msg, eventSource, eventCode, e)
{
    // Perform custom initialization.
    eventInfo = new StringBuilder();
    eventInfo.Append(string.Format(
        "Event created at: ", EventTime.ToString()));
}
' 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 e As Exception)
     MyBase.New(msg, eventSource, eventCode, e)
     ' Perform custom initialization.
     eventInfo = New StringBuilder()
     eventInfo.Append(String.Format( _
     "Event created at: ", EventTime.ToString()))
 End Sub

注解

构造 WebErrorEvent 函数不打算在代码中直接使用。 它由 ASP.NET 调用。 从 类派生WebErrorEvent时,可以调用 WebErrorEvent 构造函数。

另请参阅

适用于

WebErrorEvent(String, Object, Int32, Int32, Exception)

使用所提供的参数初始化 WebErrorEvent 类的新实例。

protected public:
 WebErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, int eventDetailCode, Exception ^ exception);
protected internal WebErrorEvent (string message, object eventSource, int eventCode, int eventDetailCode, Exception exception);
new System.Web.Management.WebErrorEvent : string * obj * int * int * Exception -> System.Web.Management.WebErrorEvent
Protected Friend Sub New (message As String, eventSource As Object, eventCode As Integer, eventDetailCode As Integer, exception As Exception)

参数

message
String

事件说明。

eventSource
Object

作为事件源的对象。

eventCode
Int32

与该事件关联的代码。 实现自定义事件时,事件代码必须大于 WebExtendedBase

eventDetailCode
Int32

用于指定事件的详细标识符的 WebEventCodes 值。

exception
Exception

与此错误关联的 Exception

示例

下面的代码示例演示如何从 WebErrorEvent 类派生以创建自定义事件。

// Invoked in case of events identified 
// by their event code.and 
// related event detailed code.
public SampleWebErrorEvent(string msg, 
    object eventSource, int eventCode, 
    int detailedCode, Exception e):
  base(msg, eventSource, 
    eventCode, detailedCode, e)
{
    // Perform custom initialization.
    eventInfo = new StringBuilder();
    eventInfo.Append(string.Format(
        "Event created at: ", EventTime.ToString()));
}
' Invoked in case of events identified 
' by their event code.and 
' related event detailed code.
 Public Sub New(ByVal msg As String, ByVal eventSource _
 As Object, ByVal eventCode As Integer, _
 ByVal detailedCode As Integer, ByVal e As Exception)
     MyBase.New(msg, eventSource, _
     eventCode, detailedCode, e)
     ' Perform custom initialization.
     eventInfo = New StringBuilder()
     eventInfo.Append(String.Format( _
     "Event created at: ", EventTime.ToString()))
 End Sub

注解

构造 WebErrorEvent 函数不打算在代码中直接使用。 它由 ASP.NET 调用。 从 类派生WebErrorEvent时,可以调用 WebErrorEvent 构造函数。

另请参阅

适用于