If you run the application and browse around a few times, you'll see the session action-list build up. By default, ASP.NET Core will use an in-memory session store, which is fine for testing purposes, but will need to be updated for a production environment: public void ConfigureServices ( IServiceCollection services ). Update ConfigureServices in Startup.cs to add the session services. Session state is not configured by default, so you need to add the required services. Then scaffold a new ASP.NET Core 2.0 MVC app using dotnet new: dotnet new mvc -framework netcoreapp2.0 Start by creating a global.json to pin the SDK version in your app directory: dotnet new globaljson -sdk-version 2.1.202 NET Core SDKs installed on my machine, I'm going to use the 2.0 SDK (version number 2.1.202) to scaffold a 2.0 project template. To demonstrate the change in behaviour related to the 2.0 to 2.1 upgrade, I'm going to start by building an ASP.NET Core 2.0 app. Using session state in an ASP.NET Core 2.0 app In the next section I'll create a small app that tracks which pages you've visited by storing a list in session state, and then displays the list on the home page. That covers what session state is and how it works.
0 Comments
Leave a Reply. |