Session State with Machine Key RRS feed

  • Question

  • User320513238 posted

    We have a .net core 2.2 application that we are moving to our UAT environment.  Our UAT, like production, has a session state server that our application use as they are behind a load balancer. With our full framework applications, we easily configured this by using the sessionState (which holds the mode, connection string, and network timeout) and machineKey tags in our web.config file.  How would we accomplish this in .net core?

    Tuesday, May 21, 2019 9:16 PM

All replies

  • User-474980206 posted
    There are a lot of options. You can a json config file or environment variables. Depending on the state server chosen, typically your code will pass the configuration values in startup. It’s up to your code to decide how read these values.

    Note: asp.net core does not support the old app.net session servers.
    Wednesday, May 22, 2019 12:16 AM
  • User320513238 posted

    Okay...so how do I configure it?  Is there some kind of Nuget package I need to download to wire all this up?  Honestly I'm not sure what kind of session state server corporate has setup and each location is supposed to use.  I suppose I'll try to get some information out of them.

    Talked to our director, he said the session state server that we configure in the web.config is just a Windows server.  Not sure if that helps.  I've never messed with load balancing before so I'm not sure how to get this working in core.

    Wednesday, May 22, 2019 12:24 PM
  • User475983607 posted

    The Data Protection Provider replaces the machine key in ASP.NET Core.


    Wednesday, May 22, 2019 1:19 PM
  • User753101303 posted


    Seems there is some confusion between ASP.NET 4.x and ASP.NET Core. Also I'm not 100% sure if you mean your application is using already a session state service and you can't find from where your app takes its configuration or if you have to use some existing service.

    For now what if you try to have a look at the Startup class to find what is configured and how ???

    Wednesday, May 22, 2019 1:21 PM
  • User320513238 posted

    We decided to simply re-write everything to avoid the use of session.

    Wednesday, May 22, 2019 2:31 PM