แก้ไข

แชร์ผ่าน


WebErrorEvent Constructors

Definition

Initializes a new instance of the WebErrorEvent class.

Overloads

WebErrorEvent(String, Object, Int32, Exception)

Initializes the WebErrorEvent class using the supplied parameters.

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

Initializes a new instance of the WebErrorEvent class using the supplied parameters.

WebErrorEvent(String, Object, Int32, Exception)

Initializes the WebErrorEvent class using the supplied parameters.

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)

Parameters

message
String

The event description.

eventSource
Object

The object that is the source of the event.

eventCode
Int32

The code associated with the event. When you implement a custom event, the event code must be greater than WebExtendedBase.

exception
Exception

The Exception associated with the error.

Examples

The following code example shows how to customize this constructor.

// 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

Remarks

The WebErrorEvent constructor is not intended to be used directly from your code. It is called by ASP.NET. You can call the WebErrorEvent constructor when deriving from the WebErrorEvent class.

See also

Applies to

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

Initializes a new instance of the WebErrorEvent class using the supplied parameters.

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)

Parameters

message
String

The event description.

eventSource
Object

The object that is the source of the event.

eventCode
Int32

The code associated with the event. When you implement a custom event, the event code must be greater than WebExtendedBase.

eventDetailCode
Int32

The WebEventCodes value that specifies the detailed identifier for the event.

exception
Exception

The Exception associated with the error.

Examples

The following code example shows how to derive from the WebErrorEvent class to create a custom event.

// 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

Remarks

The WebErrorEvent constructor is not intended to be used directly from your code. It is called by ASP.NET. You can call the WebErrorEvent constructor when deriving from the WebErrorEvent class.

See also

Applies to