想要这样的路由
不带id:http://test.mymong.com/Home/List.html
带id:http://test.mymong.com/Home/Del/561755ba3af24efa4fc09cef.html
routes.MapRoute( name: "D", url: "{controller}/{action}/{id}.html", defaults: new { controller = "Home", action = "Index" } ); routes.MapRoute( name: "E", url: "{controller}/{action}.html", defaults: new { controller = "Home", action = "Index" } );
另外需要在web.config中添加节点
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" /> </system.webServer>