services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(5);//You can set Time });