ASP.NET MVC 4网站。MVC 4:自定义路线
得到了一个名为“位置”数据库表,其中包含只有三个可能的位置(例如,“CA”,“NY”,“AT”) 默认路由是:
http://server/Location/ --- list of Locations
http://server/Location/NY --- details of NY-Location
如何我可以在没有/ Location/- 位的情况下创建自定义路线吗? (我觉得这一点更漂亮)
这样
http://server/NY - details of NY
http://server/AT - details of AT
.... etc...
和
http://server/Location --- list of Locations
将其设置在控制器中?在控制器内部,您必须指定路线,然后指定它附带的功能,对不对?所以将路由设置为'server/{city}' – Steven