title: ASP.NET MVC Controller.OnException not being called
body: <p>I have a base controller class where I'm overriding to the Controller.OnException handler method in order to provide a generic error handling for certain types of controllers that will inherit from this class (these are API controllers that will return JSON results).  The OnException method never gets called when an exception gets raised by the controller.  Does anyone see what I am doing wrong, or is there a better way to handle this situation?</p>
  
  <p>Using MVC 1.0</p>
  
  <p><strong>Base Class:</strong></p>
  
  <pre><code>public class APIController : Controller
      {
  
          protected override void OnException(ExceptionContext filterContext)
          {
             //This is never called
              filterContext.Result =
                  new JsonResult(); 
              base.OnException(filterContext);
          }
  
  
      }
  </code></pre>
  
  <p><strong>Inheriting Class:</strong></p>
  
  <pre><code>public class MyController : APIController
      {
  public AjaxResult ForcedException()
          {
              throw new SystemException();
          }
  }
  </code></pre>