开发者

problem with routing?

I have a problem with my routing in mvc.

I have this http://localhost:1138/Administration

this show the index of Administration controller

I have here two tab: 开发者_如何学CUser, MemberVIP, with his controller UserController and MemberController.

When I go to User my route is this http://localhost:1138/User but I want this http://localhost:1138/Administration/User the same with MemberVip

any idea!!

Thanks


As @Cybernate mentioned, Areas are really the best way to deal with this. If you absolutely insisted, you could hack it with a special route entry for those sub routes:

routes.MapRoute(
            "AdminUserRoute",
            "Administration/{controller}/{action}/{id}",
            new { controller = "Administration", action = "Index", id = UrlParameter.Optional });

Be sure that you position this in your list of routes so that it doesn't inadvertently catch proper routes on other URLs. You might want to try out Phil Haack's RouteDebugger (available on NuGet).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜