title: Custom action filter in MVC
body: <p>You are developing an ASP.NET MVC application.
  Before an action is executed, information about the action must be written to a log. After
  results are returned, information about the results also must be written to the log.
  You need to log the actions and results.
  You have the following code:</p>
  
  <pre><code>**Target 1**
  {
  public override void **Target 2**
  {
    Logger.Log("ActionLog", filterContext.RouteData);
  }
  public override void **Target 3**
  {
    Logger.Log("ResultLog", filterContext.RouteData);
  }
  }
  </code></pre>
  
  <p>Which code segments should you include in <strong>Target 1</strong>, <strong>Target 2</strong> and <strong>Target 3</strong> to implement the LogActionFilter class? (To answer, select the appropriate option from the list)</p>
  
  <pre><code>Option 1) public class LogActionFilter : IActionFilter
  Option 2) public class LogActionFilter : ActionFilterAttribute
  Option 3) OnActionExecuting(ActionExecutingContext filterContext)
  Option 4) OnActionExecuted(ActionExecutedContext filterContext)
  Option 5) OnResultExecuting(ResultExecutingContext filterContext)
  Option 6) OnResultExecuted(ResultExecutedContext filterContext)
  </code></pre>
  
  <p>From blog and other sources, I found 2 type of answers. Some chose Option 2, Option 3 and Option 5 respectively. If this is the case, then my question is why not Option 6 instead of Option 5.</p>
  
  <p>Please help me. I appreciate your valuable response.</p>