This is a mirror of official site: http://jasper-net.blogspot.com/

Back to the basics : Exception Management design guideline for N-tier Asp.net applications

| Thursday, February 10, 2011
Introduction

"How do you define a good Exception Management for an N-Tier Asp.net application?"

Pretty simple question, but not that much simple to answer.

We are good at making things. But, may be, we are not equally good at designing systems which properly handles errors with gracefulness, provides user with a polite message about the error and doesn't leave him/her in a dead-end, and internally, notifies the system developers with enough details so that the poor developers don't feel like they need to learn some rocket science to fix those errors.

So, If you ask me the same question, I would tell you the followings:

Your system has a good exception management if:

It doesn't show unnecessary technical error descriptions when an error occurs, rather, apologize to user with a screen that something went wrong and lets him/her go back to the system.
When an error occurs, it immediately notifies technical teams with detailed information for troubleshooting, along with logging error details.
It has exception management done in a central and manageable manner without unnecessary try..catch...throw spread across the overall code base.
So, if we want to ensure a good exception management in our Asp.net application, we need to meet these three high level objectives.

The bare minimum thing you should do

If you are the laziest developer in the world (Like what I was a few years ago), you should at least take advantage of what Asp.net offers you to handle exceptions gracefully. All you need is to perform the following two simple steps:

Enable customError in web.config:

<customerrors defaultredirect="Error.aspx" mode="On">
</customerrors>

As you might know already, this little configuration instructs the Asp.net run time to redirect to Error.aspx whenever an error occurs in your Asp.net application. Setting mode="On" instructs to redirect always, which may not be a good choice if you are developing your system. Setting mode="RemoteOnly" should be perfect choice for you as this results in redirection to the error page only when page is browsed from a remote machine.

Read more: Codeproject

Posted via email from Jasper-net

0 comments: