在我的 asp.net mvc 项目中,所有链接都显示索引操作,例如:
localhost:1559/Home/Index
localhost:1559/about-us/Index
localhost:1559/contact-us/Index
localhost:1559/portfolio/Index
为什么它不隐藏索引操作?
我想这样展示:
localhost:1559/首页
localhost:1559/about-us
localhost:1559/contact-us
localhost:1559/portfolio
这是我的全局文件代码:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.Add(
new Route("{controller}/{action}/{Q1}/{Q2}",
new RouteValueDictionary(
new { controller = "Home", action = "Index", Q1 = UrlParameter.Optional, Q2 = UrlParameter.Optional }),
new HyphenatedRouteHandler())
);
routes.Add(
new Route("{controller}/{action}/{Q1}",
new RouteValueDictionary(
new { controller = "Home", action = "Index", Q1 = UrlParameter.Optional }),
new HyphenatedRouteHandler())
);
routes.Add(
new Route("{controller}/{action}",
new RouteValueDictionary(
new { controller = "Home", action = "Index"}),
new HyphenatedRouteHandler())
);
}
谁能帮我 ?