如何通过Web.Config在Cookie中添加SameSite:none

问题描述 投票:0回答:1

我正在尝试通过web.config在所有cookie中添加samesite:none。我已经使用重写规则尝试了以下操作,但无济于事:

  <outboundRules>
  <rule name="Add SameSite None">
            <match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="true" />
            <action type="Rewrite" value="{R:0}; SameSite=none" />
  </outboundRules>
asp.net web-config csrf
1个回答
0
投票

尝试以下操作:

<rewrite>
  <outboundRules>
    <rule name="Add SameSite" preCondition="No SameSite">
      <match serverVariable="RESPONSE_Set_Cookie" pattern=".*" negate="false" />
      <action type="Rewrite" value="{R:0}; SameSite=none" />
      <conditions>
      </conditions>
    </rule>
    <preConditions>
      <preCondition name="No SameSite">
        <add input="{RESPONSE_Set_Cookie}" pattern="." />
        <add input="{RESPONSE_Set_Cookie}" pattern="; SameSite=none" negate="true" />
      </preCondition>
    </preConditions>
  </outboundRules>
</rewrite>
© www.soinside.com 2019 - 2024. All rights reserved.