asp.net set session code example
Example: 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>"; } }