且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

高级ASP.NET MVC路由方案

更新时间:2022-12-18 09:37:52

您可以在默认路由之前使用以下路由

You can use the following route before the default route

routes.MapRoute(
    null,
    "{enterprise}/{community}/{controller}/{action}/{id}",
    new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);

然后您可以在操作方法中忽略{enterprise}和{community}参数.

You can then ignore {enterprise} and {community} parameters in your action methods.