FeaturedIT topics

How to use session storage in ASP.Net Core

To store user-specific data in ASP.Net Core web applications, we use the session state. However, using session state in ASP.Net core is not straightforward—at least, session state in ASP.Net Core doesn’t work the way it used to work in legacy ASP.Net applications. This article examines how we can work with session state in ASP.Net Core.

Create an ASP.Net Core Web API project

First off, let’s create an ASP.Net Core project and install the necessary packages. If Visual Studio 2017 is up and running in your system, follow the steps outlined below to create an ASP.Net Core Web API project.

  1. Launch the Visual Studio 2017 IDE.
  2. Click on File > New > Project.
  3. Select “ASP.Net Core Web Application (.Net Core)” from the list of templates displayed.
  4. Specify a name for the project.
  5. Click OK to save the project.
  6. Select “API” in the “New .Net Core Web Application…” window.
  7. Select “.Net Core” as the runtime and ASP.Net Core 2.1 (or later) from the drop-down list of controls at the top.
  8. Select “Web Application (Model-View-Controller)” as the project template.
  9. Uncheck the “Enable Docker Support” box.
  10. Ensure that “No Authentication” is selected as we won’t be using authentication here.
  11. Ensure that “Configure for HTTPS” is unchecked as we won’t need HTTPS either. (See the figure below.)
  12. Click OK.

This will create a new ASP.Net Core 2.1 MVC project in Visual Studio 2017.

Related Articles

Back to top button