小编use*_*166的帖子

为什么抽象类不能被实例化,什么是无法实例化的类的使用

我知道并阅读有关抽象类和接口的内容,但我从未理解的一点是,无法实例化的类的用法是什么.我可以使用普通类和虚方法而不是抽象类吗?当我实例化基类时会发生什么?

c# oop

4
推荐指数
1
解决办法
2万
查看次数

启用严格传输安全 mvc

我想实现严格的运输安全。我的网站启用了 https。下面是我启用 hsts 的代码。

<system.webServer>
    <httpProtocol>
      <customHeaders>
     
          <add name="X-Frame-Options" value="SAMEORIGIN" />
          **<add name="Strict-Transport-Security" value="max-age=31536000"/>**
         .....
        </customHeaders>
    </httpProtocol>
Run Code Online (Sandbox Code Playgroud)

上面的设置足以启用严格的传输安全,还是我还需要添加下面的设置,即。

<rewrite>
      <rules>
        <rule name="HTTP to HTTPS redirect" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="off" ignoreCase="true" />
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}"
              redirectType="Permanent" />
        </rule>
      </rules> 
      <outboundRules>
        <rule name="Add Strict-Transport-Security when HTTPS" enabled="true">
          <match serverVariable="RESPONSE_Strict_Transport_Security"
              pattern=".*" />
          <conditions>
            <add input="{HTTPS}" pattern="on" ignoreCase="true" />
          </conditions>
          <action type="Rewrite" value="max-age=31536000" />
        </rule>
      </outboundRules>
    </rewrite> 
Run Code Online (Sandbox Code Playgroud)

如果这两个设置都是强制性的,那么我们需要重写什么,我们可以仅通过或仅通过重写来启用hsts。

为什么需要重写。

该网站说要添加重写alogn with

<add name="Strict-Transport-Security" value="max-age=31536000"/>

security asp.net-mvc iis-7

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net-mvc ×1

c# ×1

iis-7 ×1

oop ×1

security ×1