title: C# mvc5 - Easy way to check if user is authenticated in each controller method
body: <p>I have a controller that I only want authenticated users to be able to access. Do I have to put a check in each method in my controller to verify a user is authenticated, or is there another way to handle this? Can I use annotations to do this instead?</p>
  
  <p>Example from my controller:</p>
  
  <pre><code>public ActionResult Index()
          {
              if (UserVerified())
              {
                 ...
              }
              return RedirectToAction("Login", "Account");
          }
  
      public ActionResult FacebookLogin()
      {
          if (UserVerified())
          {
             ....
          }
  
          return RedirectToAction("Login", "Account");
      }
  
      private bool UserVerified()
      {
          if (User != null &amp;&amp; User.Identity != null &amp;&amp; User.Identity.IsAuthenticated)
          {
              return true;
          }
          return false;
      }
  </code></pre>