title: Custom Authorization Attribute Not Working
body: <p>I added custom authorize attribute to class to check if the logged in user is admin. But that is not working. Here is my code</p>
  
  <pre><code>[AdminAuthorization]
  public class UsersController : Controller
  {
      public ActionResult Index()
      {
          return View();
      }
  }
  
  public sealed class AdminAuthorizationAttribute : AuthorizeAttribute
  {
      protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
      {
          if(!UserSessionHelper.Instance.IsValid &amp;&amp; !UserSessionHelper.Instance.Data.IsAdmin)
          {
              filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary(new { controller = "Error", action = "AccessDenied" }));
          }
      }
  }
  </code></pre>
  
  <p>What am doing here in taking user data from session to check if the user is admin and if he is not admin then redirecting to access denied page. But this is not working. For every user the page is getting viewed.</p>