UI Layer for Web App -- NotifyRethrow OR None?

Topics: Exception Handling Application Block
Jan 15, 2007 at 2:03 PM
I am logging my exception at the ui layer and i have customErrors with defaultRedirect="Error.aspx", at the moment i am using PostHadlingAction = None and after handling the exception, I use Server.Transfer to the error page. My question is what is the best practice for the web app, is it NotifyRethrow and let asp.net to use the config file to redirect the user to error page?
Jan 17, 2007 at 4:41 PM
If all you want to do is log the error and transfer the person to the global error page, I recommend that you just let ASP.NET do its thing.

Log the error in Application_Error and let ASP.NET look into the customErrors section of your web.config and redirect them to the proper page. Who knows, you may want to take advantage of the fact that you can send them to specific pages based on the error code which is handled transparently by ASP.NET.

See my simple example here:

http://davidhayden.com/blog/dave/archive/2006/02/15/2802.aspx

Regards,

Dave

__________________________

David Hayden
Microsoft MVP C#
http://www.davidhayden.com/