【问题标题】:Resources not automatically loaded from Https - SecuritySwitch资源不会自动从 Https 加载 - SecuritySwitch
【发布时间】:2012-02-24 22:26:39
【问题描述】:

我正在从旧的 SecureWebPages 升级,它通过 web.config 自动在 Http 和 Https 内容之间切换。

出于某种奇怪的原因,内容如下:

<link type="text/css" href="assets/css/style.css" rel="stylesheet" />

不再从适当的 https 位置自动加载。 Google Chrome 中的控制台向我显示了这一点:

The page at https://website.com/UserAccess.aspx ran insecure content from http://website.com/assets/css/style.css.

当我使用较旧的 SecureWebPages 时,此行为不存在。在过去,上面的 CSS 语句可以正常工作,没有任何错误。

我的 web.config:

<securitySwitch mode="RemoteOnly">
<paths>
  <add path="~/Register.aspx"/>
  <add path="~/SSL.Master"/>
</paths>

我的配置有什么问题吗?请指教。谢谢!

【问题讨论】:

    标签: asp.net ssl https securityswitch


    【解决方案1】:

    您需要告诉 SecuritySwitch 忽略您的 CSS 文件夹,甚至您的整个 Assets 文件夹(如果它还包含图像等)。这是您可以添加到资产文件夹的 securitySwitch 部分的路径。

    <securitySwitch mode="RemoteOnly">
    <paths>
      <add path="~/Register.aspx"/>
      <add path="~/assets/" security="Ignore"/>
    </paths>
    </securitySwitch>
    

    这将告诉 SecuritySwitch 忽略资产文件夹及其下的所有内容。此外,您的主文件路径没有任何作用,因为 .master 文件永远不会提供给浏览器。

    我希望这会有所帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-04
      • 2021-07-31
      • 2021-01-10
      • 1970-01-01
      • 2014-09-06
      • 1970-01-01
      • 2023-01-31
      • 1970-01-01
      相关资源
      最近更新 更多