How it works...

With the HttpContext.Session object, clients have a corresponding memory space in the server's RAM. By using a Session object, we can develop applications that enable a user's entire activity to be remembered in the server. For example, if the user hasn't yet logged in, we can redirect the user to the login page; after successful login, the application can remember all properties of the logged-in user, and let the user navigate through the application. We can clear the Session object, and let the application forget the user. Logout functionality usually clears the Session object.

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.