as we know if we need to work with session in asp.net core then we need to turn on session first in middle tier like
First steps
-------------
Microsoft.AspNetCore.Session package provides middleware to manage the sessions in ASP.NET Core. To use session in our Application,
we need to add this package as a dependency in project.json file.
{"version": "1.0.0-*","buildOptions": {"debugType": "portable","emitEntryPoint": true },"dependencies": {},"frameworks": {"netcoreapp1.0": {"dependencies": {"Microsoft.NETCore.App": {"type": "platform","version": "1.0.1" },"Microsoft.AspNetCore.Mvc": "1.0.1","Microsoft.AspNetCore.Server.Kestrel": "1.0.1","Microsoft.AspNetCore.Routing": "1.0.1","Microsoft.AspNetCore.Session" : "1.0.1" },"imports": "dnxcore50" } } }
2nd steps
---------
add app.UseSession(); and services.AddSession
public class Startup { public void Configure(IApplicationBuilder app) { app.UseSession(); app.UseMvc(); app.Run(context => { return context.Response.WriteAsync("Hello Readers!"); }); } public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddSession(options => { options.IdleTimeout = TimeSpan.FromMinutes(30); }); } }
just tell me if we do not add session in middle tier then session cookie will be generated because we know each session is tracked by session cookie saved in client side ?