September 04 2019 by
Admin
In this article, we have described how to use Session in ASP.NET Core with an example and sample code.
In this article, we have described how to use Session in ASP.NET Core with an example and sample code.
The session is a server-side control and is primarily used to manage the user login but there are many uses for user session management as well.
Required Namespaces
you will need to use the following namespaces.
HTML
In the html we have taken Textbox for username and password . When the click on login button save the username in the session .
Model
Controller
In the Controller we are storing the Username in the session.
UserView.cshtml
We are get the session from user session variable.
Startup
We have provided Startup file below.
Screenshot
Note: All contents are copyright of their authors.