Results 1 to 1 of 1

Thread: Get http error codes

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2003
    Location
    Gothenburg
    Posts
    13

    Get http error codes

    Is there a way to get the http error code?

    I use the following code in my global asax.vb to write entries to the event log and would also like to send the error code(404, 503 etc).



    VB Code:
    1. Imports System.Diagnostics
    2.         Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
    3.            
    4.             Try
    5.                 Dim ErrorDescription As String = Server.GetLastError.ToString
    6.                 'Creation of event log if it does not exist  
    7.                 Dim EventLogName As String = "SibaException"
    8.                 If (Not EventLog.SourceExists(EventLogName)) Then
    9.                     EventLog.CreateEventSource(EventLogName, EventLogName)
    10.                 End If
    11.  
    12.                 ' Inserting into event log
    13.                 Dim Log As New EventLog()
    14.                 Log.Source = EventLogName
    15.                 Log.WriteEntry(ErrorDescription, EventLogEntryType.Error, [HERE IT WOULD B NICE TO SEND ERROR CODE AS INTEGER])
    16.             Catch ex As Exception
    17.             End Try
    18.  
    19.         End Sub
    Last edited by gunyan; Apr 20th, 2004 at 08:02 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width