title: Passing session variable from page to page
body: <p>I'm wondering what is my issue on passing a variable from page to page using asp.net session.</p>
  
  <p>I've stripped the code down to just one text box to see whats going on. I'm just trying to take the value of a text box and display it on a confirmation page.  When the button is clicked it transfers me to the second page but there label is blank.  Yes my post back url is pointing to the second page.</p>
  
  <p>Here is the button click:</p>
  
  <pre><code>protected void submit_Click(object sender, EventArgs e)
  {
      string name = txtFirstName.Text.Trim();
      Session["name"] = name;
  }
  </code></pre>
  
  <p>Here is the page load of the second page:</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      lblName.Text = (string)(Session["name"]);
  }
  </code></pre>
  
  <p>Unless I've been looking at this to long and missed something.  I've already read <a href="http://msdn.microsoft.com/en-us/library/03sekbw5.aspx" rel="nofollow noreferrer">"How to: Read Values from Session State"</a> from MSDN.</p>