c# - Routing same name controllers and different areas -


i have 2 same name controllers, shopcontroller, 1 normal controller (basically put them), , other 1 in area called admin.

here routes:

routes.maproute("shop", "shop/{action}/{id}", new { controller = "shop", action = "index", id = urlparameter.optional }, new[] { "cms.controllers" }); routes.maproute("categoriesrpartial", "admin/shop/categoriesnavpartial", new { controller = "shop", action = "categoriesnavpartial" }, new[] { "cms.areas.admin.controllers" }); 

the bottom supposed connected admin area one, , top 1 regular one.

i tried adding namespaces based on answer here on don't make difference, if put gibberish in not make difference.

how can have these routes refer exact controllers want?

the order when add routes route collection significant, engine route collection , first match route picked winner.

if first route matches, means start word shop hit controller shop, if not continue matching structure on routedata collection. there no need add namespaces on case

shop/{action}  -> should start shop word need specify action in anonymous object 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -