【发布时间】:2019-07-02 00:38:57
【问题描述】:
我的问题是我无法为会话设置滑动过期配置。
在使用应用程序时,身份 Cookie 正在滑动且未过期,但会话未滑动,在 IIS 会话超时后,会话正在自行更新,并且我的会话数据被清除。
这是我的启动代码:
public void ConfigureServices(IServiceCollection services)
{
// some other configurations..
services.ConfigureApplicationCookie(options =>
{
options.ExpireTimeSpan = TimeSpan.FromHours(6);
options.LoginPath = "/Auth/Login";
options.AccessDeniedPath = "/Dashboard";
options.LogoutPath = "/Auth/Logout";
options.SlidingExpiration = true;
options.Cookie.IsEssential = true;
});
services.AddSession(options =>
{
options.IdleTimeout = TimeSpan.FromHours(6);
options.Cookie.HttpOnly = true;
options.Cookie.IsEssential = true;
});
}
如何为会话的cookie设置滑动过期属性?
【问题讨论】:
标签: c# asp.net-core .net-core