asp.net mvc session management code example

Example 1: Using Session in ASP.NET MVC

private void btnSubmit_Click(object sender, System.EventArgs e)
{ if(IsValid)
  { // Set the Session value.
    Session[txtName.Text] = txtValue.Text;
    // Read and display the value we just set
    lblResult.Text = "The value of <b>" +
	 txtName.Text + "</b> in the Session object is <b>" +
	 Session[txtName.Text].ToString() + "</b>"; } }

Example 2: what is session management in asp.net

Session is a State Management Technique. 
  A Session can store the value on the Server.
  It can support any type of object to be
  stored along with our own custom objects