基本上我想这样做:
http://website.com/Home/About
http://website.com/Home/About
我试图做以下事情:
routes.MapRoute( name: "About",url: "",defaults: new { controller = "Home",action = "About",id = UrlParameter.Optional } );
有人可以帮我吗
解决方法
尝试这样:
routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "OnlyAction","{action}",new { controller = "Home",action = "Index" } ); routes.MapRoute( "Default",// Route name "{controller}/{action}/{id}",// URL with parameters new { controller = "Home",action = "Index",id = UrlParameter.Optional } // Parameter defaults );