Reputation: 21
Web application session is getting null after redirecting from Payment Gateway site. This issue happens only in Google Chrome browser. In Mozila, IE its working fine.
We are using .net MVC.
Upvotes: 1
Views: 1322
Reputation: 507
This new concept has come to save your application by attacker. So, here is the option to allow/restrict cookie for sameSite
.
This problem got Chrome 80 or later in 2020 and it introduces new cookie values and cookie policies. Three values can be passed into the updated SameSite attribute: Strict
, Lax
, or None
. If you don't specify SameSite
attribute in <httpCookies>
then it will default to SameSite=Lax
.
Now, Lax
is good for same site. If you are using cross site or iframe(it is also consider as cross site) then you need to use none
. And if you want to restrict your cookie then you need to use Strict
.
Example:
http
or https
, You need to do following steps--<httpCookies domain="xyz.com" requireSSL="true" sameSite="None" />
You can use some attribute for <SessionState>
<sessionState allowCustomSqlDatabase="true" cookieSameSite="None" sqlConnectionString="Data Source=serverName; Initial Catalog=databaseName;
User ID=userid;Password=pass;" timeout="55"/>
For local access, You need to do following steps--
Default
, change the state as Disabled
requireSSL="false"
(on local system)One special case for Iframe
. If you are using Iframe to load different application in your application. Then your session will be null
in private(incognito) window in chrome.
I have one solution for this special case. You need to use cookieless="true" in
```. Only if when you are not using cookies in your application.
For your reference:
https://learn.microsoft.com/en-us/aspnet/samesite/system-web-samesite
https://learn.microsoft.com/en-us/microsoftteams/platform/resources/samesite-cookie-update https://learn.microsoft.com/en-us/office365/troubleshoot/miscellaneous/chrome-behavior-affects-applications
Upvotes: 1