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

一、路由规则:
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>
 
 

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

上一篇:字符串转换成json的三种方式


下一篇:JQuery传值给.ashx乱码