c# - asp.net mvc custom sub routes -
im trying set custom route admin/settings/{action}/{id}
routes.maproute( name: "adminsettings", url: "admin/settings/{action}/{id}", defaults: new { controller = "settings", action = "index", id = urlparameter.optional } );
and want
admin/settings
- controller settings , action index
and
admin/settings/mail
controller settings , action mail
how can fix achieve routes?
make sure route added routes collection before default route. otherwise both of urls mapped default route {controller}/{action}/{id}
. in first case have
// admin/settings controller = "admin", action = "settings"
in second case
// admin/settings/mail controller = "admin", action = "settings", id = "mail"
Comments
Post a Comment