title: ASP.NET MVC 5 - return special error page instead of custom error page
body: <p>I am not entirely sure about the title of my question. What I need is to set up custom error pages for common errors - 404, 500, etc. but I also need my own "special" error pages for particular errors.</p>
  
  <p>I configured custom error pages served by IIS like below and it is working fine. Something happens, error 500 is raised and <code>/Error/InternalServerError</code> is served and original URL is kept.</p>
  
  <p>But if I access <code>/Error/Special</code> I have problem. If I set status code to 500, I will get content of error page <code>/Error/InternalServerError</code> instead of content 
   of <code>/Error/Special</code> with status code 500. <code>TrySkipIisCustomErrors = true</code> is not working because of <code>web.config</code>.</p>
  
  <p>I have this in my web.config:</p>
  
  <pre><code>&lt;httpErrors errorMode="Custom" existingResponse="Replace"&gt;
    &lt;clear/&gt;
    &lt;error statusCode="500" path="/Error/InternalServerError" responseMode="ExecuteURL" /&gt;
  &lt;/httpErrors&gt;
  </code></pre>
  
  <p>And this controller:</p>
  
  <pre><code>public class ErrorController : Controller
  {
      // special error page
      public ActionResult Special()
      {
          //Response.StatusCode = (int)HttpStatusCode.InternalServerError; // &lt;- I cant set status code because IIS returns error page (custom error page) instead
          //Response.TrySkipIisCustomErrors = true; // &lt;- needs httpErrors - existingResponse="Passthrough" but custom error pages are not working with it
          return View();
      }
  
      public ActionResult InternalServerError()
      {
          Response.StatusCode = (int)HttpStatusCode.InternalServerError;
          return View();
      }
  }
  </code></pre>
  
  <p>Why I need "special" error pages? I want to do something like this:</p>
  
  <pre><code>public class SpecialController : Controller
  {      
      public SpecialController()
      {
          // something
      }
  
      protected override void OnActionExecuting(ActionExecutingContext filterContext)
      {
          base.OnActionExecuting(filterContext);
  
          if ( something != true )
          {
              // it would be nice to do it without redirect, just return /Error/Special and stop executing original request
              filterContext.Result = new RedirectToRouteResult(
                          new RouteValueDictionary
                          {
                              { "action", "Special" },
                              { "controller", "Error" }
                          });
          }
      }
  }
  </code></pre>
  
  <p>Am I missing something?</p>