
正文
【Asp.Net MVC】日常---路由
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
想要这样的路由
不带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>







