【问题标题】:Session state not maintaining while accessing site from cordova (android/ios webview) or Chrome > 80 after windows 10 updateWindows 10 更新后从 cordova (android/ios webview) 或 Chrome > 80 访问站点时会话状态不保持
【发布时间】:2020-04-24 21:51:16
【问题描述】:
从cordova(android/ios webview)访问asp.net mvc应用程序时,每个请求中的会话ID都会不断变化。
这仅在 Windows 10 更新 之后发生,在它正常工作之前。
当我尝试使用 phonegap windows 客户端从 chrome/firefox 浏览器访问时,会话工作正常,但如果我在 android/ios 设备中安装该应用程序,它就无法正常工作。
【问题讨论】:
标签:
asp.net-mvc
google-chrome
cordova
cookies
webview
【解决方案1】:
基于答案https://stackoverflow.com/a/59300799/1019435
在 web.config 中添加 system.web 下的吹风线
必须为 IIS 安装 URL Rewrite。
<rewrite>
<outboundRules>
<rule name="AddSameSiteCookieFlag">
<match serverVariable="RESPONSE_Set-Cookie" pattern="((.*)(ASP.NET_SessionId)(=.*))(SameSite=Lax)" />
<action type="Rewrite" value="{R:1};SameSite=" />
</rule>
</outboundRules>
</rewrite>
或
<sessionState cookieSameSite="None" />