Here is the startup.cs code:
And web.config:
- services.AddDataProtection().SetDefaultKeyLifetime(TimeSpan.FromDays(14));
- //.PersistKeysToFileSystem(new DirectoryInfo("./Keys/"));
- services.AddDistributedMemoryCache();
- services.AddHttpContextAccessor();
- services.ConfigureApplicationCookie(options => {
- options.Cookie.Expiration = TimeSpan.FromMinutes(30);
- options.ExpireTimeSpan = TimeSpan.FromDays(3);
- });
- services.AddSession(options =>
- {
- options.Cookie.Name = ".app.Session";
- options.IdleTimeout = TimeSpan.FromMinutes(30);
- options.Cookie.HttpOnly = true;
- options.Cookie.IsEssential = true;
- options.Cookie.SecurePolicy = CookieSecurePolicy.None;
- });
- services.AddStactive();
- "1.0" encoding="UTF-8"?>
-
-
-
"aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" /> -
"bin\IISSupport\VSIISExeLauncher.exe" arguments="-argFile IISExeLauncherArgs.txt" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false"> -
-
"true" /> -
"true" /> -
-
"true" />
Do I need to add any extra configuration either in startup.cs or web.config to make sure session values are available until the SQL session is Timeout?
My current project is developed using ASP.NET core 2.1
Can someone help me with this situation on handling session variables on IIS servers?
Thanks!!
My current project is developed using ASP.NET core 2.1
Can someone help me with this situation on handling session variables on IIS servers?
Thanks!!

Aakash NPosted Jan 8, 2019, 12:32 PM
Thanks for your response!!
I configured my IIS the same way link you have shared with me, But this(return null when getSession variables) still happens on the server. And when I use IDistributedCache, I'm able to set and get the cache values from SQL Server but HttpContect.SetSession and HttpContext.GetSession are not working.
Do you have any further suggestions for me to work on in order to keep the session variables live on IIS Servers?
Jignesh KumarPosted Jan 8, 2019, 10:15 AM
Aakash NPosted Jan 8, 2019, 8:02 AM
Yes I'm using app.UseSession() above app.UseMvc()
Bryian TanPosted Jan 7, 2019, 4:09 PM