1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
private void RegisterRoutes(RouteCollection routes)
{
routes.RouteExistingFiles = false;
// URL: /
routes.Add("home",
new Route(null,
new HomeRouteHandler()
));
// URL: /fr-fr/
routes.Add("localized", new Route("{p0}",
new RouteValueDictionary { { "p0", string.Empty } },
new RouteValueDictionary { { "p0", "[a-zA-Z]{2}-[a-zA-Z]{2}" } },
new LangageRouteHandler()
));
// URL: /profils/
routes.Add("profils", new Route("{p0}",
new RouteValueDictionary { { "p0", string.Empty } },
new RouteValueDictionary { { "p0", "profils" } },
new ProfilsRouteHandler()
));
} |
Partager