title: How do I redirect to the "Error" view page after an AJAX call?
body: <p>I have an Ajax calling an HTTP Post Action method in the controller.</p>
  
  <p>This action method is throwing a simple exception message.</p>
  
  <p>I have decorated the controller with my own custom handler attribute with the following:</p>
  
  <pre><code> public override void OnException(ExceptionContext filterContext) {
  
          if (!filterContext.ExceptionHandled) {
              string actionName = filterContext.RouteData.Values["action"].ToString();
              Type controllerType = filterContext.Controller.GetType();
              var method = controllerType.GetMethod(actionName);
              var returnType = method.ReturnType;
              string controllerName = filterContext.RouteData.Values["controller"].ToString();
  
              HandleErrorInfo model = new HandleErrorInfo(filterContext.Exception, controllerName, actionName);
  
              // redirect on error
              filterContext.Result = new ViewResult {
                  ViewName = "Error",
                  ViewData = new ViewDataDictionary&lt;HandleErrorInfo&gt;(model)
              };
          }
  
          filterContext.ExceptionHandled = true;
          filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
      }
  </code></pre>
  
  <p>The issue with above is that for some reason, with a POST method, my page doesn't get redirected to the Error View. However, if I call an action method that has been decorated with the [HttpGet], my redirect will work properly.</p>
  
  <p>Is it possible to redirect an AJAX method to the Error View as I would like the Error view page to handle all errors?</p>