title: How do I know current Action is pass authorized or not in ActionFilterAttribute on MVC?
body: <p>As you know if we want to authorize we can rewrite <strong>AuthorizeAttribute</strong>, but currently I want to know current action is pass authorize or not in the <strong>ActionFilterAttribute</strong></p>
  
  <p>For example: This is for authorize:</p>
  
  <pre><code>public class AdminAuthorizeAttribute : AuthorizeAttribute
  {
       public override void OnAuthorization(AuthorizationContext filterContext)
       {
             // if authorize then continue, or else redirection the action to some page for some user
       }
  }
  </code></pre>
  
  <p>This is for access Log, This is the place I want to know <strong>current request is authorized or not</strong></p>
  
  <pre><code>public class LoggerFilterAttribute : ActionFilterAttribute
  {
     public override void OnActionExecuting(ActionExecutingContext filterContext)
     {
       // before save the access log, I want to know current request is authorized or not, then I can write the authorize status to the access log/
     }
  }
  </code></pre>
  
  <p><strong>Update1:</strong></p>
  
  <p>I'm <strong>not use</strong> the default User.Identity or Role.
  I'm using my own authrize role from database and session.
  For example:</p>
  
  <pre><code>public class AdminAuthorizeAttribute : AuthorizeAttribute
      {
          public string ActionName {get; set;}
           public override void OnAuthorization(AuthorizationContext filterContext)
           {
                if (null == GetSession("AdminNo"))
                  {
                      // Authorized failed. redirect
                  }
  
                if (null == GetSession("RoleName")
                  {
                     // Authorized failed. redirect
                  }
                else{
                       if (!GetSession("ActionInRole").include(ActionName))
                       {
                          // Authorized failed. redirect
                       }
                    }
  
             // Authorized success.
           }
      }
  </code></pre>