【问题标题】:Session/Cookies are resetting to blank in Asp.Net MVC application in an iframe会话/Cookie 在 iframe 中的 Asp.Net MVC 应用程序中重置为空白
【发布时间】:2020-07-10 12:21:07
【问题描述】:

最近将 chrome 更新到 80(版本 80.0.3987.149(64 位))并清除浏览器的 cookie 后,我们在 ASP.Net MVC 应用程序中看到以下问题。

重定向到其他页面时,会话/Cookie 将重置为空白。应用程序嵌入在 iFrame 中。

我尝试通过以下方式在 web.config 中将同一站点设置为“无”,但它们都不起作用 -

<sessionState cookieSameSite="None" timeout="60" />

<httpCookies sameSite="None" />

还安装了 URL 重写以覆盖 IIS 上设置的 cookie -

<rewrite>
    <outboundRules>
        <rule name="AddSameSiteCookieFlag">
            <match serverVariable="RESPONSE_Set-Cookie" pattern="^(.*)(CFID|CFTOKEN|JSESSIONID|ASP.NET_SessionId)(=.*)$" />
            <action type="Rewrite" value="{R:0};SameSite=None" />
        </rule>
    </outboundRules>
</rewrite>

请帮忙...

提前致谢。

【问题讨论】:

    标签: c# asp.net-mvc google-chrome iframe session-cookies


    【解决方案1】:

    经过大量研究后,我遇到了类似的问题。通过在&lt;sessionState&gt; 中添加requireSSL 属性来解决

    <httpCookies sameSite="None" requireSSL="true"  />
    

    【讨论】:

      猜你喜欢
      • 2012-08-03
      • 2020-04-19
      • 1970-01-01
      • 2020-12-13
      • 2011-03-10
      • 2013-02-02
      • 1970-01-01
      • 1970-01-01
      • 2012-05-24
      相关资源
      最近更新 更多