I created the MVC Core (Framework) application and I use Identity to login. When I click "Remember Me", everything is fine on my development machine, but after deployment on the server machine, "Remember Me" does not support login after 30 minutes.
I tried to check if the cookie expiration date is set and everything seems to be in order, also on the server machine the cookie seems to be well set. You can see my cookies in the following image:

Can someone help me solve this problem?
Thank you in advance for your reply :)
EDIT:
As required by Orhun, I add my Startup.cs content below:
public partial class Startup
{
public SymmetricSecurityKey signingKey;
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
if (env.IsDevelopment())
{
builder.AddUserSecrets<Startup>();
}
builder.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfigurationRoot Configuration { get; }
public void ConfigureServices(IServiceCollection services)
{
string conn = CreateConnectionString(Configuration.GetConnectionString("TiesseWebConnection"));
services.AddScoped<System.Data.Entity.DbContext>((_) => new TiesseWeb.DAL.TiesseWebEntities(conn));
services.AddMemoryCache();
services.AddDistributedMemoryCache();
services.AddSession();
services.AddSingleton<IConfiguration>(Configuration);
services.AddOptions();
services.Configure<Settings>(Configuration.GetSection("Settings"));
services.AddScoped<Settings>();
services.AddScoped<Tiesse.Web.BL.TiesseWebManager>();
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("TiesseWebConnection")));
services.AddIdentity<ApplicationUser, ApplicationRole>(i =>
{
i.SecurityStampValidationInterval = TimeSpan.FromDays(14);
})
.AddEntityFrameworkStores<ApplicationDbContext, int>()
.AddDefaultTokenProviders();
services.AddMvc().AddJsonOptions(jsonOptions =>
{
jsonOptions.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore;
}); ;
services.AddTransient<IEmailSender, AuthMessageSender>();
services.AddTransient<ISmsSender, AuthMessageSender>();
services.AddAuthorization(options =>
{
options.AddPolicy("Admin", policy => policy.RequireClaim("Admin"));
options.AddPolicy("Admin-Utenti", policy => policy.RequireClaim("Admin-Utenti"));
options.AddPolicy("Admin-Filiali", policy => policy.RequireClaim("Admin-Filiali"));
options.AddPolicy("Admin-Reparti", policy => policy.RequireClaim("Admin-Reparti"));
options.AddPolicy("GoogleDrive", policy => policy.RequireClaim("GoogleDrive"));
options.AddPolicy("GoogleDrive-Gestione", policy => policy.RequireClaim("GoogleDrive-Gestione"));
options.AddPolicy("GoogleDrive-Gestione-Struttura", policy => policy.RequireClaim("GoogleDrive-Gestione-Struttura"));
options.AddPolicy("GoogleDrive-Consultazione", policy => policy.RequireClaim("GoogleDrive-Consultazione"));
options.AddPolicy("Reports", policy => policy.RequireClaim("Reports"));
options.AddPolicy("Reports-Test", policy => policy.RequireClaim("Reports-Test"));
});
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
app.UseSession();
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseIdentity();
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
CookieHttpOnly = true,
CookieSecure = CookieSecurePolicy.Always,
ExpireTimeSpan = TimeSpan.FromDays(30),
SlidingExpiration = true,
AutomaticAuthenticate = true,
AutomaticChallenge = true
});
app.UseGoogleAuthentication(new GoogleOptions()
{
ClientId = "XXXXXXX....",
ClientSecret = "XXXXXXX....",
AutomaticAuthenticate = true
});
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
public static string CreateConnectionString(string providerConnectionString)
{
var entityBuilder = new EntityConnectionStringBuilder();
entityBuilder.ProviderConnectionString = providerConnectionString;
entityBuilder.Provider = "System.Data.SqlClient";
entityBuilder.Metadata = @"res://*/TiesseWebDB.csdl|res://*/TiesseWebDB.ssdl|res://*/TiesseWebDB.msl";
return entityBuilder.ConnectionString;
}
}