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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -