How to Change ASP.NET MVC Controller Name in URL?

后端 未结 5 1972
挽巷
挽巷 2020-12-17 09:56

If we have \"example_name\" we can change it in url using [ActionName(\"\")] So, i want to do this for controller name.

I can do t

5条回答
  •  忘掉有多难
    2020-12-17 10:41

    user449689s answer is good, but he forgot to mention you need to add

    routes.MapMvcAttributeRoutes();
    

    into RegisterRoutes() of your RouteConfig.cs

提交回复
热议问题