The recommended approach really depends on what you need to do with the error information.
For simple applications, just configure the web.config file to redirect to a friendly page with an error.
It is generally recommended that you write raw error data to a database, file, Windows application log, or web service, processing it using the Global.asax Application_Error event. You can also use web.config to get your friendly page with this. As a rule, I would not recommend using Windows error logs, since they are usually a little dumb, but there is nothing wrong with that.
Tools such as log4net are widely used to get very detailed information about work, including warnings and informational messages. You usually go on this route for products or applications at the enterprise level, where your support groups need as much information as possible to diagnose errors.
MSDN has some basic error handling settings and what you can do with them.
source share