ASP.NET MVC 2 Preview 2: Areas duplicate controller problem

前端 未结 2 1052
旧巷少年郎
旧巷少年郎 2021-02-09 21:44

I am continuing to enslave the MVC 2 thing: Areas...

Now I have two controllers with the same name (HomeController) in the main Controllers folder and in one of the Area

2条回答
  •  有刺的猬
    2021-02-09 22:16

    If the two controllers with the same class name are in two different areas, this works as expected.

    In your case, you have one controller in an area, and one controller in the "default Controllers folder". Are you sure this is what you want? Is your "default Controllers folder" supposed to contain some kind of shared controllers, such as the default account controller?

    This is really an ASP.NET Routing issue as opposed to a namespace or class name issue. The problem is most likely that you have two routes to the ambiguous controller name; one registered via area registration and one via the default route registration in RegisterRoutes.

    Also, see this post about area ordering.

提交回复
热议问题