.Net核心重新写入严格的网址

时间:2018-09-09 05:23:23

标签: c# url-rewriting .net-core

我已经在.net core 2.1上进行了项目设计,在其中我重写了类似的网址

var rewrites = new RewriteOptions()
                    .AddRewrite(@"GetCountryInfo", "Home/GetCountryInfo", skipRemainingRules: true)
                    .AddRewrite(@"about-us", "Home/About", skipRemainingRules: true)
                    .AddRewrite(@"pricing", "Home/Pricing", skipRemainingRules: true)
                    .AddRewrite(@"sign-in", "Home/Sign_in", skipRemainingRules: true)
                    .AddRewrite(@"sign-up", "Home/Sign_up", skipRemainingRules: true)

它工作正常,但是当使用此网址添加内容时,它的工作原理也是不可接受的。

localhost:5000/about-us/abc
localhost:5000/about-us1

我想从网址中忽略此/ abc或1。我该如何实现?

0 个答案:

没有答案