如何解决通过 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 实现吗?我正在使用 IIS 中托管的 ASP.NET 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>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。