February 2010
Beginner
400 pages
11h 13m
English
ASP.NET MVC is very easy to customize and extend. You don't like how the view engine works? No problem—you can override it. ASP.NET MVC is a framework practically begging for customization.
One of the easiest ways to extend the existing ASP.NET MVC functionality is by writing extension methods on some of the HtmlHelper classes. For example, you might need to render a home page link to a specific page throughout your application. To accomplish this, you can create an extension method.
Let's do so now. Create a new class called UrlHelperExtension.cs:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc;
namespace Chapter13.BobsMoviesMVC.Controllers ...