Chapter 9. Customizing and extending ASP.NET MVC

 

This chapter covers

  • Data templates and HTML helpers
  • Action filters
  • Custom model binders
  • Search engine optimization of routing

Chapter 8 introduced you to the pillars of ASP.NET MVC: controllers, views, models, and routing. These concepts are the basic ones you have to master to start writing applications with this new web development platform. But when we move to real-world contexts, things tend to get a bit more complicated.

So far, you’ve learned a lot. You know how to handle a web request by using an appropriate combination of a controller, a model, and a view, but in more complex scenarios, these notions alone aren’t usually enough. In fact, enterprise-level applications are often made of multifaceted pages, which are difficult to build and maintain unless you can split them into simpler and discrete components. Sometimes things get even harder, requiring you to plug your own custom logic into the framework itself to make it tie in to your specific needs.

ASP.NET MVC has several entry points you can use to inject your own code to extend and customize it. In this chapter, we’re going to explore some of these features, specifically the ones shown in figure 9.1.

9.1. Building reusable elements in ASP.NET MVC

9.2. User input handling made smart

9.3. Improving ASP.NET MVC routing

9.4. Summary