gpt4 book ai didi

ASP.NET MVC : Rewriting with routing

转载 作者:行者123 更新时间:2023-12-02 11:15:01 24 4
gpt4 key购买 nike

我想映射以下 URI:

/admin/controller/action/id

以下内容:

Controller -> Controller
Action -> Admin_Action

例如:

/admin/Users/Create

Controller -> Users
Action -> Admin_Create

/admin/Users/Delete/1

Controller -> Users
Action -> Admin_Delete(1)

我可以使用路由规则来实现这一点吗?

最佳答案

我认为以下路由映射应该有效......

 routes.MapRoute("YourRouteName", "admin/controller/action/{id}", new { controller = "Controller", action = "Admin_Action", id = UrlParameter.Optional });

关于ASP.NET MVC : Rewriting with routing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7681351/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com