System Exception

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to get to the last exception in .Net from outside a catch
block? I've inherited someone else's ASP.Net app that's having problems. He
is calling a method to log his errors but is only passing his custom error
messages so there is no way to know what is really happening. What I would
like to do is to access the last exception that occurred from the LogError()
function rather than have to modify all of the places that it is being called
to pass extra information to it.

Is there anything in .Net that provides access to the last exception data...
Message, StackTrace, etc?

Thanks,
Todd
 
I think the capability to have these type of event handlers is really useful.
However, these errors are already being trapped. The error trap is calling
a LogError() function passing it a string. Rather than go to every call to
LogError() and modify the string being passed, I would like to be able to get
to the last exception object from within the LogError() function itself.
That way I'll only need to make a code change in one place.
 
You can also look at Server.GetLastError. I'm not clear on what your
application is doing, but this property may work for you.
 
I tried this but GetLastError() returns NULL, probably because I'm already
trapping the error. All the documentation says that it's used to get the
last UNTRAPPED error. Looks like I'm down to modifying each call.
 
Back
Top