title: How to get a value from a session in ASP.NET 4.0 and store it to a textbox/ label
body: <p>i must to a project for school ,i must build an asp.net (4) site
  and i need to get a value from  a session variable and to store it in an textbox or label what ever. I've tried with textbox until now........and i got stuck.</p>
  
  <p>My session variable declare on page Default.aspx:   </p>
  
  <pre><code>Session["user"] = username;
  </code></pre>
  
  <p>My textbox code on Home.aspx page :</p>
  
  <pre><code>&lt;div class="content"&gt;&lt;!--D2--&gt;
  &lt;form id="form1" runat="server"&gt;
      &lt;div class="logged"&gt;&lt;!--D3--&gt;
          &lt;p class="i_am"&gt;You are logged in as:&lt;asp:TextBox ID="txt_loggedas"      runat="server" &gt;&lt;/asp:TextBox&gt;
          &lt;/p&gt;
          &lt;asp:LinkButton ID="LinkButton1" runat="server" OnClick="LogOut"&gt;[Log Out]&lt;/asp:LinkButton&gt;
  </code></pre>
  
  <p>I tried answers from this link: <a href="https://stackoverflow.com/questions/6791030/how-to-display-a-session-value-in-an-asp-textbox">how to display a session value in an ASP textbox</a>,  but i didn't succeed x-( </p>