ASP.net MVC 2.0 不同Areas中相同名Controller的问题
刚开始学mvc碰到的问题
项目名 MvcApplication,建立了 HomeController的控制器
建立了个叫Admin的区域,里面也有个 HomeController
运行后提示需要按照命名空间的方式注册MapRoute
修改代码按照命名空间的方式注册后问题依旧
Admin区域注册代码
Public Overrides Sub RegisterArea(ByVal context As System.Web.Mvc.AreaRegistrationContext)
context.MapRoute(
"Admin_default",
"Admin/{controller}/{action}/{id}",
New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional},
New String() {"MvcApplication.Areas.Admin.Controllers"}
)
End Sub
Global.asax.vb中也使用了命名空间
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional},
New String() {"MvcApplication.Controllers"}
)
我新建立了一个项目是c#的,用此方法运行成功,为什么vb.net不行呢?