我正在使用Asp.Net web forms.In我的网址,我不想暴露在字符'?‘之后。我希望正则表达式模式使用IIS10来实现这一点。我已经尝试了这个“安全(.+)$”,但它不起作用。
下面是:www.some.com/Security/login.aspx?name=dfdf
关于这个:www.some.com/Security/login.aspx
发布于 2019-11-19 11:22:42
如果您不想公开查询字符串。
1.您应该将对www.some.com/Security/login.aspx?name=dfdf的任何请求重定向到www.some.com/Security/login.aspx.
2.然后您必须将来自www.some.com/Security/login.aspx的请求重写回www.some.com/Security/login.aspx?name=dfdf
请记住,此规则只能重写回静态查询字符串?name=dfdf。
如果需要动态重写URL,则可能需要添加一个自定义请求头来保存查询字符串。因此后端服务器将知道它应该重写回哪里。
<rules>
<rule name="redirect rule" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/Security/login.aspx\?(.+)" />
</conditions>
<action type="Redirect" url="Security/login.aspx" appendQueryString="false" redirectType="Temporary" />
</rule>
<rule name="rewrite back" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/Security/login.aspx$" />
</conditions>
<action type="Rewrite" url="Security/login.asp?name=dfdf" appendQueryString="false" />
</rule>
</rules>https://stackoverflow.com/questions/58908939
复制相似问题