不使用区域,通过命令控制器和子控制器进行路由
如何为项目管理应用程序创建路由结构,其中所有相关部分都有离散控制器,例如任务控制器、文档控制器等以及总体控制器。我基本上想要这样的结构:
http://server/Project/123/Task http://server/Project/123/Document
我正在使用 mvc1,所以我无法访问区域项目部分将为项目控制器(例如任务、文档等)提供一个单独的母版页,并具有不同的菜单导航。我在 Global.asax 中尝试了三种路线,例如:
routes.MapRoute(
"Task",
"Project/{id}/Task/{action}",
new { controller = "Task", action = "Index", id = "" }
);
routes.MapRoute(
"Message",
"Project/{id}/Message/{action}",
new { controller = "Message", action = "Index", id = "" }
);
routes.MapRoute(
"Document",
"Project/{id}/Document/{action}",
new { controller = "Document", action = "Index", id = "" }
);
我在这里做错了什么
How can I create a routing structure for a project management application where there are discrete controllers for all the relevant pieces such as TaskController, DocumentController etc and an Over arching controller. I would essentially like a structure like:
http://server/Project/123/Task
http://server/Project/123/Document
I am using mvc1 so I have no access to areas etc. The project section will have a separate master page for project controllers such as task, document etc with a dfferent menu navigaton. I have tried three routes together n Global.asax like:
routes.MapRoute(
"Task",
"Project/{id}/Task/{action}",
new { controller = "Task", action = "Index", id = "" }
);
routes.MapRoute(
"Message",
"Project/{id}/Message/{action}",
new { controller = "Message", action = "Index", id = "" }
);
routes.MapRoute(
"Document",
"Project/{id}/Document/{action}",
new { controller = "Document", action = "Index", id = "" }
);
What am I doing wrong here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用路由调试器查看出了什么问题 http:// haacked.com/archive/2008/03/13/url-routing-debugger.aspx
Use the route debugger to see what is going wrong http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx