我使用 asp.net MVC 开发了一个网站
我们确实对站点进行了扫描,它给出了一个 CSRF,要求将站点 cookie 设置为同一站点。在 web.config 中尝试了下面的代码,但似乎它只能从 4.7.1 开始工作 -
我们有什么办法可以在 .Net 4.6 中实现这一点,非常需要帮助:)
<httpCookies cookieSameSite="None" />
Run Code Online (Sandbox Code Playgroud)
<rewrite>
<outboundRules>
<rule name="Add SameSite" preCondition="No SameSite">
<match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" />
<action type="Rewrite" value="{R:0}; SameSite=strict" />
<conditions>
</conditions>
</rule>
<preConditions>
<preCondition name="No SameSite">
<add input="{RESPONSE_Set_Cookie}" pattern="." />
<add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=strict" negate="true" />
</preCondition>
</preConditions>
</outboundRules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)