Created
January 18, 2010 21:52
-
-
Save softcraft-development/280410 to your computer and use it in GitHub Desktop.
Two RESTful routes for global.asax in ASP.NET 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) | |
{ | |
// Matches /Controller/ModelID (with an optional /Action) | |
routes.MapRoute( | |
"Details", | |
"{controller}/{id}/{action}", | |
new { action = "Details" } | |
); | |
// Matches /Controller; typically this represents a list of all models for a particular controller. | |
routes.MapRoute( | |
"Index", | |
"{controller}", | |
new { controller = "Home", action = "Index"} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment