MVC 伪静态html页面的访问

 

不需要配置IIS来实现

1. 路由配置

  context.MapRoute(
      name: "Default",
      url: "{controller}/{action}/{id}.html",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
      );

2.Web.config设置如下节点

  <system.webServer>

    <modules runAllManagedModulesForAllRequests="true"></modules><!--关键-->

  </system.webServer>

posted @ 2016-12-28 14:41  风筝线  阅读(543)  评论(0)    收藏  举报