1
我不得不从网址等传递用户请求:ASP .NET核心:路由。多个类别中的URL在begining
site.com/events/2017/06/wwdc.html
或多个共同的:
site.com/category1/subcategory1/subcategory2/...../subcategoryN/page-title.html
例如
site.com/cars/tesla/model-s/is-it-worth-it.html
到ArticlesController
用行动Index(string title)
或类似的东西。
在编译时我不知道我会有多少段。但我知道,这些网址将以/{pageTitle}.html
结尾。主要问题是,默认的asp.net核心路由不允许我写东西,如{*}/pageTitle.html
这可能吗?
该航线将捕获的所有请求,比如'类/ title.html'不仅事 唯一能帮助我的是把这个规则在最后... 感谢 – mokeev1995
这条路线必须到位最后,对。 您可以通过在过滤器中应用正则表达式来过滤'category/title.html'等内容。 'template:“{* query:regex(。+ /。+ \\。html $)}”,'将完美满足您的需求;)(如果运行良好,您也可以提出我的答案:-p) –
不能,我没有足够的信誉... – mokeev1995