您的位置:首页 > 编程语言 > ASP

ASP.NET MVC 自定义后缀路由设置

2016-02-03 23:37 645 查看
RouteConfig中添加路由
routes.MapRoute(
name: "ky",
url: "{controller}/{action}.ky",
defaults: new { controller = "Home", action = "Index" }//UrlParameter.Optional
);


形如
url: "{controller}/{action}/{id}.ky",
的话页面内跳转直接ActionName就不好用了 所以一般习惯直接*.ky?ID=1

类似 <a href="Home_Index.ky">首页</a>

同时WebConfig中configuration > system.webServer > modules 的runAllManagedModulesForAllRequests 属性设为true
<system.webServer>

<modules runAllManagedModulesForAllRequests="true">

<remove name="FormsAuthentication" />

</modules>

</system.webServer>


IIS8以下版本需要添加额外设置~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  asp.net mvc routeConfig