共用方式為


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 建構函式。

另請參閱

適用於