WebRequestErrorEvent 构造函数

定义

初始化 WebRequestErrorEvent 类的新实例。

重载

WebRequestErrorEvent(String, Object, Int32, Exception)

使用指定的事件参数对 WebRequestErrorEvent 类进行初始化。

WebRequestErrorEvent(String, Object, Int32, Int32, Exception)

使用指定的事件参数对 WebRequestErrorEvent 类进行初始化。

注解

用于定义事件代码或标识符的值必须大于 WebExtendedBase 字段常量。

WebRequestErrorEvent(String, Object, Int32, Exception)

使用指定的事件参数对 WebRequestErrorEvent 类进行初始化。

protected public:
 WebRequestErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, Exception ^ exception);
protected internal WebRequestErrorEvent (string message, object eventSource, int eventCode, Exception exception);
new System.Web.Management.WebRequestErrorEvent : string * obj * int * Exception -> System.Web.Management.WebRequestErrorEvent
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 SampleWebRequestErrorEvent(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

注解

此构造函数允许你创建 WebRequestErrorEvent 事件,而无需指定有关事件本身的详细代码信息。

适用于

WebRequestErrorEvent(String, Object, Int32, Int32, Exception)

使用指定的事件参数对 WebRequestErrorEvent 类进行初始化。

protected public:
 WebRequestErrorEvent(System::String ^ message, System::Object ^ eventSource, int eventCode, int eventDetailCode, Exception ^ exception);
protected internal WebRequestErrorEvent (string message, object eventSource, int eventCode, int eventDetailCode, Exception exception);
new System.Web.Management.WebRequestErrorEvent : string * obj * int * int * Exception -> System.Web.Management.WebRequestErrorEvent
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

事件详细信息代码标识符。

exception
Exception

与此错误关联的 Exception

示例

下面的代码示例演示如何使用此构造函数。

// Invoked in case of events identified 
// by their event code.and related event 
// detailed code.
public SampleWebRequestErrorEvent(
    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

注解

如果需要指定有关事件的详细代码信息,请使用此构造函数。

适用于