You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rolf Kristensen edited this page Jan 1, 2022
·
1 revision
ASP.NET Session ID.
Platforms Supported: All
Configuration Syntax
${aspnet-sessionid}
Enable sessions in ASP.NET Core
Add line to ConfigureServices() in Startup.cs
publicvoidConfigureServices(IServiceCollectionservices){
...services.AddMvc();services.AddSession();// After AddMvc()services.AddHttpContextAccessor();
...}
Add line to Configure() in Startup.cs
publicvoidConfigure(IApplicationBuilderapp,IHostingEnvironmentenv){
...app.UseSession();// Before UseMvc()app.UseMvc();
...}