IIS 7 on Windows Server 2008 R2 SP1
I have added the following rule to my web.config to redirect all incoming request to HTTPS
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
It fails when ampersands (&) are present in the URL or file name. I've looked at some of the solutions offered and am not interested in allowing special characters through the registry. Is there a way to perform a rewrite to encode the ampersand to & or %26 prior to the redirect rule? Does the HTTPS redirect rule use the original URL or the newly rewritten/encoded version?