0
votes

I have the following problem:

I send a request via HttpResponse.Redirect method to a web application: http(s)://localhost/application?arg1=abc^def. This works pretty fine on IE/Edge/Chrome/Firefox.

But on Safari I get the problem that the request is sent as following enconded string:

http(s)://localhost/application.aspx?arg1=abc%5Edef

The application does not like/accept that and I am not able to perform changes on the application.

Is it possible to rewrite the URL on the webserver where the application is hosted by IIS Rewrite module somehow?

I tried already to create a rule with following regex pattern:

^application?(.*)%5E(.*)

and the following action:

Rewrite URL: application.aspx?{R:1}%5E{R:2}

...but this does not seem to work (although the regex pattern has passed the "Test Pattern" test)

Many thanks in advance!

1
Hi, thanks a lot for your answer! I did not have the possibility to test it. I will do it tomorrow and give you feedback :)crazyivan
Hi, unfortunately not. I am fighting about 15h now with this issue but the rewrite still does not work. I will try to enable iis url rewrite logging and continue to troubleshoot...crazyivan
Is it because the rewrite module is not installed? You can refer to this link to reinstall the rewrite module: stackoverflow.com/questions/64290889/…Ding Peng
Hi, has the problem been solved?Ding Peng

1 Answers

0
votes

This is because there is a problem with your rewrite rules. The following configuration will rewrite http://localhost/application.aspx?arg1=abc%5Edef to http://localhost/application?arg1=abc^def:

    <rewrite>
        <rules>
            <rule name="TEST" stopProcessing="true">
                <match url="(application.aspx)" />
                <action type="Rewrite" url="http://localhost/application?{C:1}^{C:3}" appendQueryString="false" />
                <conditions>
                    <add input="{QUERY_STRING}" pattern="(.*)(%5E)(.*)" />
                </conditions>
            </rule>
        </rules>
    </rewrite>