ASP.NET Session

In ASP.NET session is a state that is used to store and retrieve values of a user.

It helps to identify requests from the same browser during a time period (session). It is used to store value for the particular time session. By default, ASP.NET session state is enabled for all ASP.NET applications.

Each created session is stored in SessionStateItemCollection object. We can get current session value by using Session property of Page object. Let's see an example, how to create an access session in asp.net application.


ASP.NET Session Example

In the following example, we are creating a session and storing user email. This example contains the following files.

// Default.aspx

Code

// Default.aspx.cs

Output:

This application will store user email to the session when user login.
ASP Net Session 1

It will show stored session value, user email.

ASP Net Session 2




Contact US

Email:[email protected]

ASP.NET Session
10/30