Asp.net mvc 带后缀的自定义属性路由
我想像这样创建我的url:Asp.net mvc 带后缀的自定义属性路由,asp.net-mvc,asp.net-mvc-5,asp.net-mvc-routing,routeattribute,Asp.net Mvc,Asp.net Mvc 5,Asp.net Mvc Routing,Routeattribute,我想像这样创建我的url: www.example.com/Content/page.html 在我的ContentController上,我使用: [RoutePrefix("Home")] 除索引操作外,我还使用: [Route("page.html")] 但当我请求此url时,将发生以下错误: HTTP Error 404.0 - Not Found 我怎样才能解决这个问题? 感谢您的帮助您需要更改web.config以使其正常工作。在下面的行中添加: <system.web
www.example.com/Content/page.html
在我的ContentController上,我使用:
[RoutePrefix("Home")]
除索引操作外,我还使用:
[Route("page.html")]
但当我请求此url时,将发生以下错误:
HTTP Error 404.0 - Not Found
我怎样才能解决这个问题?
感谢您的帮助您需要更改
web.config
以使其正常工作。在下面的行中添加:
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
有关此功能的更多信息,请参见: