我是 asp.net mvc 的初学者。
我有 2 个控制器:
HomeController 动作: index,about
我需要的网址:
index action url: mydomain
about action url: mydomain/about
其他控制器动作:索引
index action url: mydomain/other
MyCode 那不起作用:
routes.MapRoute(
"Other",
"{controller}/{action}/{id}",
new { controller = "Other", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
谢谢