簡體   English   中英

Internet Explorer無法重定向到HTTPS,其他瀏覽器可以正常工作

[英]Internet Explorer not redirecting to HTTPS, other browsers work fine

我有一個web.Release.config重寫規則,可將流量重定向到HTTPS,但在IE中似乎不起作用。 在Chrome和Firefox中運行良好。 知道我缺少什么嗎? 我已經檢查了IE Advanced Internet選項,但沒有發現任何錯誤。

<rewrite>
  <rules>
    <rule name="Redirect to https" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
      <match url="(.*)" ignoreCase="false" />
      <conditions>
        <add input="{HTTPS}" pattern="off" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
    </rule>
  </rules>
</rewrite>

我們不再使用重寫!

只需App_Start\\FilterConfig.cs添加到文件App_Start\\FilterConfig.cs

filters.Add(new RequireHttpsAttribute());

如果您需要將環境設置為僅生產:

#if !DEBUG
    filters.Add(new RequireHttpsAttribute());
#endif

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM