routes - asp.net mvc 4 Controller within a contoller -


can have controller within controller.

i have users controller , want add roles controller, want access roles controller within users controller so: /users/roles/index rather creating controller , accessing via /roles/index

imho can define route

//mapping vanity url user roles routes.maproute(    "rolesroutename", // route name    "user/{action}/{index}/{id}",     new { controller = "roles", action = "index", id = urlparameter.optional} ); 

and use as

@html.routelink("routelinktext", "rolesroutename", new { id =1212 }) 

Comments