Overview

Session State

public void ConfigureServices(IServiceCollection services)
{
	// Adds a default in-memory implementation of IDistributedCache.
	services.AddDistributedMemoryCache();

	services.AddSession(options =>
	{
		options.Cookie.Name = ".AdventureWorks.Session";
		// Set a short timeout for easy testing.
		options.IdleTimeout = TimeSpan.FromSeconds(10);
		options.Cookie.HttpOnly = true;
	});

	services.AddMvc();
}

public void Configure(IApplicationBuilder app)
{
	app.UseSession();
	app.UseMvcWithDefaultRoute();
}