Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie(cookieOptions => {
cookieOptions.LoginPath = "/";
});
services.AddMvc().AddRazorPagesOptions(options => {
options.Conventions.AuthorizeFolder("/admin");
}).SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment