title: Error Logging: Source Error and Source File
body: <p>When developing a .Net web application, if a run time error is generated, it shows some "extra" debug information that I can't find in the Exception class.</p>
  
  <p>It shows a "Source Error" section which shows a code excerpt with line numbers showing exactly where the error was generated and it shows the "Source File", the actual page that threw the exception.</p>
  
  <p><a href="https://i.stack.imgur.com/SsFRC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SsFRC.png" alt="alt text"></a>
  </p>
  
  <p>Can this information be gathered and logged programatically?</p>
  
  <p>FYI I'm not using an error logging framework, the app simply captures errors in the Global.asax.cs file and writes the contents of the exception to a DB table.  Maybe this is where I'm going wrong.  Let me know if i'll need to adopt a framework to support quality logging.</p>