【发布时间】:2010-01-28 16:28:59
【问题描述】:
我升级到 MVC 2,更新了我所有的程序集(也复制到本地)。
我将路线更改为:
routes.MapRoute(
"Admin",
"admin/{controller}/{action}/{id}",
new { controller = "Admin", action = "index", id = ""},
new[] { "MyNamespace.Web.Controllers.Admin" } // namespace
);
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" }, // Parameter defaults
new[] { "MyNamespace.Web.Controllers" } // namespace
);
我的控制器看起来像:
/controllers/admin/ProductController.cs
/controllers/ProductController.cs
我仍然收到错误:
he controller name 'Product' is ambiguous between the following types:
MyNamespace.Web.Controllers.Admin.ProductController
MyNamespace.Web.Controllers.ProductController
是否应该添加命名空间来解决这个问题?
【问题讨论】:
标签: c# asp.net asp.net-mvc asp.net-mvc-2