The first two items we are going to discuss is error handling using the web.config and the global.asax files.
Custom errors are beneficial in many aspects. You can either hide errors or provide a more detailed error messages. To utilize custom errors you must use the customErrors section within your web.config file.
<customErrors mode="on" defaultRedirect="MyApplicationError.aspx">
<error statusCode = "404" redirect="My404.aspx">
' Feel free to add other error types…
If you prefer there is another option that you may use on a page to page basis.
<%@ Page ErrorPage=" MyApplicationError.aspx" %>
As indicated the global.asax can also be used to assist you in error handling. One beneficial item you could do here is to establish a method that that will send out an email to an individual or individuals when an error occurs. This way you can be proactive and tackle the issue when it arises.
At this point you time you should understand the basics of using of the try...catch...finally blocks for wrapping statements that could fail and the use of the web.config and global.asax files to assist in error handling.