Is Enabling Double Escaping Dangerous?

Edit: Added emphasis to relevant sections.

Basically: IIS is being excessively paranoid. You can safely disable this check if you’re not doing anything particularly unwise with the uri decoded data (such as generating local filesystem URI’s via string concatenation).

To disable the check do the following (from here): (see my comment below for what double escaping entails).

<system.webServer>
    <security>
        <requestFiltering allowDoubleEscaping="true"/>
    </security>
</system.webServer>

If the plus symbol is a valid character in a search input, you will need to enable “allowDoubleEscaping” to permit IIS to process such input from the URI’s path.

Finally, a very simple, if limited workaround is simply to avoid ‘+’ and use ‘%20’ instead. In any case, using the ‘+’ symbol to encode a space is not valid url encoding, but specific to a limited set of protocols and probably widely supported for backwards-compatibility reasons. If only for canonicalization purposes, you’re better off encoding spaces as ‘%20’ anyhow; and this nicely sidesteps the IIS7 issue (which can still crop up for other sequences, such as %25ab.)

Leave a Comment