Loading ...

Store and Retrieve values from Session | CodeAsp.Net

Store and Retrieve values from Session

0 (0votes)

Asp.net provides Session for storing data that is unique for the individual user.
Session is stores on the server side.

Storing data in session:
//Storing first Name in Session like:

Session ["firstName "] = txtFirstName.Text;

Retrieve data from session:

first check the session is variable is null or not.
if (Session["firstName "] != null)
//Retrieving firstName from Session
litWelcome.Text = "Welcome: " + Session["firstName"];
//Do something else


When we assign a value in the session then we can use that session value anywhere in the application.

Comments (no comments yet)

  • :*
  • :*
  • :

Top Posts