通过 web.config ASP.NET MVC 删除查询字符串
Removing query string through web.config ASP.NET MVC
我有一种情况需要从 url 中删除查询字符串。
示例 1:https://www.sample.com/**?glCountry=AU&glCurrency=AUD**
示例 2:https://www.sample.com/christmas-gifts**?glCountry=US&glCurrency=USD**
我可以通过 web.config 实现吗?我正在使用 ASP.NET IIS 中托管的 MVC C#
这个规则在我的测试中可以很好地工作。
<rule name="remove querstring" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{QUERY_STRING}" pattern="glCountry=.*" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/{R:0}" appendQueryString="false" />
</rule>
当我检查失败请求跟踪日志时,它显示查询字符串已被删除。
我有一种情况需要从 url 中删除查询字符串。
示例 1:https://www.sample.com/**?glCountry=AU&glCurrency=AUD**
示例 2:https://www.sample.com/christmas-gifts**?glCountry=US&glCurrency=USD**
我可以通过 web.config 实现吗?我正在使用 ASP.NET IIS 中托管的 MVC C#
这个规则在我的测试中可以很好地工作。
<rule name="remove querstring" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{QUERY_STRING}" pattern="glCountry=.*" />
</conditions>
<action type="Redirect" url="http://{HTTP_HOST}/{R:0}" appendQueryString="false" />
</rule>
当我检查失败请求跟踪日志时,它显示查询字符串已被删除。