Error log: original error and original file
When developing a .Net web application, when a runtime error occurs, it displays some "extra" debugging information that I cannot find in the Exception class.
It shows the "Original Error" section, which shows a snippet of code with line numbers showing exactly where the error was thrown, and it shows "Source File", the actual page that threw the exception.
alt text http://i39.tinypic.com/2wfjszr.jpg
Is it possible to collect and record this information programmatically?
FYI I am not using an error logging framework, the application just captures the errors in the Global.asax.cs file and writes the contents of the exception to the DB table. Perhaps this is where I am going wrong. Let me know if I need to implement a framework to support quality registration.
a source to share
You should have a look at the ELMAH project , which will allow you to automatically record and log all unhandled exceptions, including the yellow screen of death recording.
For every error, as well as for the YSOD and stack trace, the server variables will also be recorded so you can see information like http referrer, requested page, etc.
It can log exceptions in various databases or XML files and send you an email as they are logged. It can be integrated into a running .Net web application without changing the line of code by simply adding entries to the web.config
You can also write log entries programmatically if you want to catch the exception but still log it.
More information is on the ELMAH website and a getting started guide on Elmah.io .
a source to share
the page where the error was reported must be in the Exception.StackTrace property
http://msdn.microsoft.com/en-us/library/system.exception.stacktrace.aspx
I'm not sure where the piece of code you mentioned comes from.
a source to share