語言

WebRequestErrorEvent 建構函式

定義

初始化 WebRequestErrorEvent 類別的新執行個體。

多載

名稱 Description
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

備註

如果你需要指定事件的詳細程式碼資訊,請使用此建構器。

適用於