views:

10

answers:

0

I would like to have some urls redirect to another server using url rewrite and here is part of the sample web.config I created:

<system.webServer>
    <rewrite>
        <rewriteMaps>
            <rewriteMap name="Redirect">
                <add key="logon\.aspx" value="http://machineB/logon.aspx" />
            </rewriteMap>
        </rewriteMaps>
        <rules>
            <rule name="Redirect rule1 for Redirect" patternSyntax="ECMAScript" stopProcessing="true">
                <match url="(.*)" />
                <conditions>
                    <add input="{Redirect:{URL}}" pattern="(.+)" />
                </conditions>
                <action type="Redirect" url="{Redirect:{R:0}}" appendQueryString="true" redirectType="Found" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>

Redirect works fine for http://machineA/logon.aspx but it fails with query string, i.e. http://machineA/logon.aspx?user=abc is not working. I wonder what should be the correct rule settings such that I could have http://machineA/logon.aspx[whateverquerystring] redirects to http://machineB/logon.aspx[whateveryquerystring]?