iis 10中的URL重写模式

iis 10中的URL重写模式,iis,iis-10,Iis,Iis 10,我正在使用Asp.Net web表单。在我的URL中,我不想在字符“?”之后公开。我希望正则表达式模式使用IIS 10实现这一点。我已经尝试过这个“安全(.+)$”,但它不起作用 由此:www.some.com/Security/login.aspx?name=dfdfdf 对此:www.some.com/Security/login.aspx如果您不想公开查询字符串 1.您应该将任何请求重定向到www.some.com/Security/login.aspx?name=dfdfdf到www.s

我正在使用Asp.Net web表单。在我的URL中,我不想在字符“?”之后公开。我希望正则表达式模式使用IIS 10实现这一点。我已经尝试过这个“安全(.+)$”,但它不起作用

由此:
www.some.com/Security/login.aspx?name=dfdfdf


对此:
www.some.com/Security/login.aspx

如果您不想公开查询字符串

1.您应该将任何请求重定向到www.some.com/Security/login.aspx?name=dfdfdfwww.some.com/Security/login.aspx

2.然后您必须将请求从www.some.com/Security/login.aspx重写回www.some.com/Security/login.aspx?name=dfdfdfdf

请记住,此规则只能重写回静态查询字符串?name=dfdfdf

如果需要动态重写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>