title: Proper way of displaying User's Name on the Menu in ASP.NET
body: <p>I am using <code>ASP.NET/C#</code>.</p>
  
  <p>I am currently displaying the Logged In User's First Name and Middle Name by making use of <code>Session</code>.</p>
  
  <p>Here is the code </p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;li&gt;&lt;a href="#"&gt;&lt;%=Session["UserFName"]%&gt;&amp;nbsp;&lt;%=Session["UserMName"]%&gt;&amp;#9660;&lt;/a&gt;
  </code></pre>
  
  <p><strong>Code Behind:</strong></p>
  
  <pre><code>//Call the function which returns User's Name
  var userName = userBLL.GetUserName(HttpContext.Current.User.Identity.Name);
  if (userName != null)
  {
  Session["UserFName"] = userName.FirstName;
  Session["UserMName"] = userName.MiddleName; 
  }
  </code></pre>
  
  <p><strong>Here is the GetUserName function</strong></p>
  
  <pre><code>public Users_AdditionalInfo GetUserName(string userCode)
  {
  using (var db = new DataClasses1DataContext())
  {
  var userName = db.Users_AdditionalInfos.Where(user =&gt; user.UserCode.Equals(userCode)).SingleOrDefault();
  return userName; 
  }
  
  }
  </code></pre>
  
  <p>Is using <code>Session variables</code> to do what I am trying to do is all right?</p>
  
  <p>What are some other ways that many of you do to achieve this?</p>
  
  <p>Any suggestions are welcome.</p>