I want to create a site where I display my apps. I use MVC 3.
My Home controller is a typical overview page where I’ll list all my apps. Then there is the App controller, where if you click on a app on a overview could get more info… url scenario would be:
http://myhost.com <-- overview
http://myhost.com/App/app_name <-- render info about that app
But I’m having a small problem understanding routes, thought i did it right:
routes.MapRoute(
"App", // Route name
"{controller}/{id}", // URL with parameters
new { controller = "App", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
And how do I get a hold of id in the controller?
Would your app rule not be more specific, that is
Note replaced
{controller}withApp