Last active
December 26, 2015 09:59
-
-
Save FernandoVezzali/7133208 to your computer and use it in GitHub Desktop.
Custom Route MVC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void RegisterRoutes(RouteCollection routes) | |
{ | |
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); | |
routes.MapRoute( | |
name: "CustomRoute", | |
url: "{controller}/{action}/{startYear}/{startMonth}/{startDay}/{endYear}/{endMonth}/{endDay}", | |
defaults: new | |
{ | |
controller = "Home", | |
action = "Index", | |
startYear = 2013, | |
startMonth = 6, | |
startDay = 1, | |
endYear = 2013, | |
endMonth = 6, | |
endDay = 30, | |
} | |
); | |
routes.MapRoute( | |
name: "Default", | |
url: "{controller}/{action}/{id}", | |
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment