.Net MVC伪静态实现

伪静态的好处就不多说了   这里说一下Mvc具体实现的方法

第一步 

 打开根目录的Web.config 给webServer 节点下的modules 添加属性runAllManagedModulesForAllRequests="true"

<system.webServer>
  <modules runAllManagedModulesForAllRequests="true">
  </modules>
</system.webServer>

第二步

在  App_Start 文件夹下 RouteConfig.cs文件下添加

routes.MapRoute(
name: "myl",//名字不要用Default
url: "{controller}/{action}.html",
defaults: new { controller = "Home", action = "Index" }
);

ko

正常运行

 

 加后缀.html

页面正常

 

posted @ 2019-09-18 11:51  長安  阅读(132)  评论(0编辑  收藏  举报