0

I have a rule in the config file intended to redirect http to https and it works but it also duplicates the parameters in the query string.

So this...

http://sitename.com/?param=4

becomes this...

https://sitename.com/?param=value&param=4

I should mention that when I start with an https this doesn't happen so it has to be my transform code. This looks right to me...

      <rule name="HTTP to HTTPS Redirect" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
      <match url="*" negate="false" />
      <conditions logicalGrouping="MatchAny">
        <add input="{HTTPS}" pattern="off" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}{PATH_INFO}" redirectType="Permanent" appendQueryString="false"/>
    </rule>
John
  • 371
  • 2
  • 4
  • 16
  • have you tried this https://stackoverflow.com/questions/9823010/how-to-force-https-using-a-web-config-file ... also you can remove the entire rewrite rule by using `GlobalFilters.Filters.Add(new RequireHttpsAttribute());` in `Global.asax.cs` – GregH Mar 28 '19 at 20:27
  • Isn't that what I have now? – John Mar 28 '19 at 20:28
  • no. its similar though – GregH Mar 28 '19 at 20:30
  • There are various solutions on there. What's the difference? Replacing PATH_INFO with REQUEST_URI? Also, the call to RequireHttpsAttribute() wouldn't be universal would it? It would only apply to MVC controllers? – John Mar 28 '19 at 20:40
  • Maybe try a few of the suggestions @John and see if they work? – mjwills Mar 28 '19 at 21:08

0 Answers0