title: Defining a User with User.Identity.Name in controller constructor
body: <p>For my actions that are going to interact with the User's account, I would like to create a "TheUser" object in addition to adding that object to "ViewData["TheUser"]" as soon as any action on my controller is called.</p>
  
  <p>If the User is logged in, it will grab the User's info from the database, if not, "TheUser" object will just be null.</p>
  
  <p>I tried accessing "User.Identity.Name" in the controller constructor, but it isn't created prior to any action being called.</p>
  
  <p>I was looking at custom authorization filters, but those wouldn't allow me to create the "TheUser" object and store it in the ViewData.</p>
  
  <p>This is a brief snippet of what I would like to accomplish:</p>
  
  <pre><code>[Authorize]
  public class HomeController : Controller
  {
      User TheUser;
  
      public HomeController()
      {
          TheUser = User.Identity.IsAuthenticated ? UserRepository.GetUser(User.Identity.Name) : null;
  
          ViewData["TheUser"] = TheUser;  
      }
  }
  </code></pre>