Summary

This chapter covered a tremendous amount of ground. It started off with a discussion of code partitioning and how it helps to reduce bugs that are caused by failure to update repetitive code. The introduction of code-behind classes helps you to better separate your user interface logic from your business logic. Leveraging user controls enables you to reuse pieces of user interface code much more efficiently than using include files in traditional ASP web applications. ASP.NET continues to support and encourage the use of business objects to encapsulate frequently used business logic in your web applications

Next, the chapter moved on to control-of-flow guidelines to help you prevent bugs from happening in the first place. We covered how Switch and Case constructs are often superior to multiple If statements. The importance of a single exit point to both functions and loops was also stressed. This was followed with a discussion of when and how to use structured exception handling in your ASP.NET web applications.

We rounded out the chapter with a discussion on how to implement a global exception handler to log both unhandled exceptions in your ASP.NET web applications and handled exceptions that you still want to be logged. In this discussion, you were introduced to the <customerrors> tag in the config.web file, and you learned how it is used to specify a custom error page that the user will be redirected to in the event of an error.

The next chapter discusses conditional compiling and shows how it enables you to toggle between debug and production code quickly and easily.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset