Exception handling using an HttpModule

前端 未结 6 1446
渐次进展
渐次进展 2021-02-10 04:24

We\'re reviewing one of the company\'s system\'s exception handling and found a couple of interesting things.

Most of the code blocks (if not all of them) are inside a t

6条回答
  •  [愿得一人]
    2021-02-10 05:03

    I'm from the school of thought where try/ catch blocks should be used and exceptions not rethrown. If you have executing code which is likely to error then it should be handled, logged and something returned. Rethrowing the exception only serves the purpose to re-log later in the application life cycle.

    Here's an interesting post on how to use a HttpModule to handle exceptions: http://blogs.msdn.com/rahulso/archive/2008/07/13/how-to-use-httpmodules-to-troubleshoot-your-asp-net-application.aspx and http://blogs.msdn.com/rahulso/archive/2008/07/18/asp-net-how-to-write-error-messages-into-a-text-file-using-a-simple-httpmodule.aspx

提交回复
热议问题