Hi,
In an aspx web page I'm doing this:
Try
Throw new IndexOutOfRangeException
Catch ex As Exception
Dim myException As New bizException(ex)
Throw myException
End Try
In the global.asax I'm doing this:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim myException As bizException = DirectCast(Server.GetLastError().GetBaseException(), bizException)
End Sub
An this error is occuring during the cast:
InvalidCastException: Unable to cast object of type 'System.IndexOutOfRangeException' to type 'bizException'.
The GetLastError's type is IndexOutOfRangeException and not bizException... Why ?