我有动作SomethingEditor,SomethingDelete,SomethingSave,SomethingAdd,我想设置这些路由:site / Something / Editor,site / Something / Delete,site / Something / Save etc
我怎么做?
答案 0 :(得分:1)
使用以下路线:
routes.MapRoute(null, "site/Something/Editor", new { controller = "Something", action = "SomethingEditor" });
routes.MapRoute(null, "site/Something/Delete", new { controller = "Something", action = "SomethingDelete" });
routes.MapRoute(null, "site/Something/Save", new { controller = "Something", action = "SomethingSave" });
routes.MapRoute(null, "site/Something/Add", new { controller = "Something", action = "SomethingAdd" });
的更新:强>
我强烈建议为每个实体使用单独的控制器,路由如下:
routes.MapRoute(null, "site/{controller}/{action}");