I currently have a custom error page in my application that automatically emails me with any errors that occur. To get the error details I do something like this:
Dim ex As Exception = HttpContext.Current.Server.GetLastError()
If TypeOf ex Is HttpUnhandledException AndAlso ex.InnerException IsNot Nothing Then
ex = ex.InnerException
End If
If ex IsNot Nothing Then
Dim s As New StringBuilder
s.AppendLine("Message:" & Environment.NewLine & ex.Message & Environment.NewLine)
s.AppendLine("Source:" & Environment.NewLine & ex.Source & Environment.NewLine)
s.AppendLine(Go to the complete details ...