title: Extended HandleError Attribute - status code 112031 (connection reset)
body: <p>I created a new class which inherits from the HandleErrorAttribute to handle ajax requests differently.  The only override is on the OnException method:</p>
  
  <pre><code>    public override void OnException(ExceptionContext filterContext)
      {
          if (filterContext.RequestContext.HttpContext.Request.IsAjaxRequest())
          {
              filterContext.ExceptionHandled = true;
              filterContext.HttpContext.Response.Clear();
              filterContext.HttpContext.Response.StatusCode = 500;
              filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
              filterContext.Result = new JsonResult { Data = errorText };
              return;
          }
          base.OnException(filterContext);
      }
  </code></pre>
  
  <p>This does work, about half the time.  When it works, the status code in the response is 500 and the error message is provided.  When it doesn't, the status code is 12031 and the error message is empty.</p>
  
  <p>Apparently status code 12031 is means:  </p>
  
  <p>ERROR_INTERNET_CONNECTION_RESET
                 The connection with the server has been reset.</p>
  
  <p>No idea why this would be occurring.</p>