1 using System.Web.Mvc;
2 using System.Web.Routing;
3
4 namespace MvcMovie
5 {
6 // Note: For instructions on enabling IIS6 or IIS7 classic mode,
7 // visit
8
9 public class MvcApplication : System.Web.HttpApplication
10 {
11
12
13 public static void RegisterRoutes(RouteCollection routes)
14 {
15 routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
16
17 // PlainRouteHandler implements IRouteHandler which returns a custom IHttpHandler (PlainHttpHandler)
18 routes.Add(new Route("{controller}", new MvcMovie.Controllers.PlainRouteHandler()));
19
20 routes.MapRoute(
21 name: "Default",
22 url: "{controller}/{action}/{id}",
23 defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
24 );
25 }
26
27 protected void Application_Start()
28 {
29 AreaRegistration.RegisterAllAreas();
30
31 RegisterRoutes(RouteTable.Routes);
32 }
33 }
34 }