一、路由规则:
routes.MapRoute(
name: "Default2",
url: "{controller}/{action}.html/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
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"/>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>