开发者

Question about ASP.NET MVC routing

I have actions SomethingEditor, SomethingDelete, Som开发者_如何学CethingSave, SomethingAdd and i want set these routing: site/Something/Editor, site/Something/Delete, site/Something/Save etc

How i can do it?


Using the following routes:

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" });


UPDATE:

I strongly recommend using a seperate controller for each entity with the following route:

routes.MapRoute(null, "site/{controller}/{action}");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜