title: TempData lost on page reload
body: <p>I use TempData to store login user role but after the user logs in and presses F5 to reload the page, I run into an error stating that <code>Object reference not set to an instance of an object</code></p>
  
  <p>I use TempData because my page needs redirection. 
  The user fills in the login form before submitting it, I don't know how to retrieve the posted data since I need to redirect the user to admin page in case his role is <code>administrator</code> or just <code>standard</code> page in case his is <code>normal user</code>.</p>
  
  <pre><code>    private bool IsAdmin(string username)
      {
          return (Roles.GetRolesForUser(username).ToList().Contains("administrator"));
      }
  
      public ActionResult AdminLayout() 
      {            
          if(IsAdmin(TempData["LoginUsername"].ToString())) //Error TempDate on Reload
          {
               return View();
          } 
          else
          {
               return Index();
          }
      }
  </code></pre>