0

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 encoded 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!

LazyOne
  • 158,824
  • 45
  • 388
  • 391
  • 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 Oct 21 '20 at 16:12
  • 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 Oct 24 '20 at 19:19
  • Is it because the rewrite module is not installed? You can refer to this link to reinstall the rewrite module: https://stackoverflow.com/questions/64290889/php-http-error-500-19-internal-server-error – Ding Peng Oct 26 '20 at 01:21
  • Hi, has the problem been solved? – Ding Peng Oct 28 '20 at 07:39

1 Answers1

0

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>
Ding Peng
  • 3,702
  • 1
  • 5
  • 8