mvc2/3/4_伪静态_路由配置

Posted on 2014-02-21 14:46  中园  阅读(327)  评论(0编辑  收藏  举报
一、路由规则:
routes.MapRoute(
                name: "Default2",
                url: "{controller}/{action}.html/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

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

完成以上还不足够,还需要在webconfig配置:
<system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
 
 
转载请注明出处:博客园-中园