.net core 2捕获所有路由但忽略了一些网址

时间:2018-04-13 12:48:08

标签: .net routes core

我开始升级使用catch all handler的旧WebForms CMS。 在.Net Core 2中,我创建了一条路线:

routes => {
                routes.MapRoute(
                    name: "NodeHandler",
                    template: "{*url}",
                    defaults: new { controller = "Node", action = "Index" );                                        
            }

默认情况下捕获全部。如何获取忽略某些目录的路径。

1 个答案:

答案 0 :(得分:0)

基于属性的路由。在控制器中使用[NonAction]属性,这样就不会为操作创建路径。

默认路由(模板)是{controller} / {action} / {id},但您可以使用此方法使用非操作方法。

Controllers and Actions