我知道并阅读有关抽象类和接口的内容,但我从未理解的一点是,无法实例化的类的用法是什么.我可以使用普通类和虚方法而不是抽象类吗?当我实例化基类时会发生什么?
我想实现严格的运输安全。我的网站启用了 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"/>