本文介绍了从付款集成页面重定向后的.Net Core 2.2应用程序丢失了会话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.net核心应用程序从支付网关应用程序返回后丢失了当前会话。
,在注册付款时,我们提供returnPath网址,付款成功后,它将重定向到会话退出的登录页面,而不是提供的returnPath网址。

.net core application losses its current session after returning from the payment gateway application.while registering to payment we are providing the returnPath url and after payment success it redirects to login page with session out instead of the returnPath url provided.

我在Startup.cs中的cookiepolicyoptions

This is my cookiepolicyoption in Startup.cs

services.Configure<CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded = context => false;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });

这是会话配置:-

            services.AddSession(options => {
                options.IdleTimeout = TimeSpan.FromMinutes(30);
                options.Cookie.HttpOnly = true;
                options.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.Strict;
            });

有人可以帮忙吗?

推荐答案

我已通过将Samesite严格模式更改为无来解决了问题

I have solved issue by changing Samesite strict mode to none

services.AddSession(options => {
                options.IdleTimeout = TimeSpan.FromMinutes(30);
                options.Cookie.HttpOnly = true;
                options.Cookie.SameSite = Microsoft.AspNetCore.Http.SameSiteMode.None;
            });

这篇关于从付款集成页面重定向后的.Net Core 2.2应用程序丢失了会话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 21:35