我在我的asp.net mvc 3解决方案中创建了一个名为admin的新区域。 Visual Studio会自动分配命名空间:
MyApp.areas.admin.controllers
我将把这个改成
MyApp.admin.controllers
,但它停止解析该操作。如有任何帮助,将不胜感激。谢谢。我在我的asp.net mvc 3解决方案中创建了一个名为admin的新区域。 Visual Studio会自动分配命名空间:
MyApp.areas.admin.controllers
MyApp.admin.controllers
,但它停止解析该操作。如有任何帮助,将不胜感激。谢谢。在为管理员区域注册路由时,您需要指定新的命名空间。
在您的 \Areas\admin\adminAreaRegistration.cs 文件中,您需要修改 RegisterArea() 方法如下:
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"admin_default",
"admin/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional },
new string[] { "MyApp.admin.Controllers" } // specify the new namespace
);
}