【发布时间】:2012-04-19 14:43:53
【问题描述】:
假设我们有三个控制器(ASP.NET MVC3):
- NewProductController (view ->index)
- ProductModelController (view ->index(int productid))
- ProductDetailsController (view =>index(int productid, int productModelId))
用户可以从 NewProductController 的索引视图中选择产品或产品+产品型号。 根据选择,我们需要重定向到 ProductModelController 或 ProductDetailsController 的索引视图。请指导我如何做到这一点。
我们希望将 URL 重写为类似
的东西,而不是在 URL 中显示控制器的名称http://www.myDomain/List of product
http://www.myDomain/List of LG TV
请建议我执行此操作的最佳方法。
谢谢, 保罗
【问题讨论】:
-
我觉得你应该有一个产品控制器:(
-
查看stackoverflow.com/questions/6118840/mvc3-and-rewrites/… 以了解在 asp.net mvc3 中的 url 重写。
-
你可以使用routing。
标签: asp.net-mvc-3 url-rewriting hyperlink redirect