Created
November 17, 2019 23:18
-
-
Save aykuttasil/204736c317535297aee8ff59f9a8dcc1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
services.Configure<CookiePolicyOptions>(options => | |
{ | |
// This lambda determines whether user consent for non-essential cookies is needed for a given request. | |
options.CheckConsentNeeded = context => true; | |
options.MinimumSameSitePolicy = SameSiteMode.None; | |
}); | |
services.AddAntiforgery(o => o.SuppressXFrameOptionsHeader = true); | |
services.AddDistributedMemoryCache(); | |
services.AddSession(options => // <-------- | |
{ | |
// Set a short timeout for easy testing. | |
// options.IdleTimeout = TimeSpan.FromSeconds(10); | |
options.Cookie.HttpOnly = true; | |
options.Cookie.IsEssential = true; // make the session cookie Essential | |
}); | |
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment