title: Can I tell IIS 8.5 to return a 404 when using httpErrors?
body: <p>I'm working on a (Web Forms) site running on IIS 8.5 and am currently setting up error handling for 404s and 500s.</p>
  
  <p>I already have the <code>system.web</code> > <code>customErrors</code> setup, but since we're running in Integrated mode/newer version of IIS it's pulling from <code>system.webServer</code> > <code>httpErrors</code>.</p>
  
  <p>Using the IIS GUI I opted to replace the standard IIS error pages with a static HTML file, on the site:</p>
  
  <pre><code>&lt;httpErrors errorMode="Custom"&gt;
      &lt;remove statusCode="404" subStatusCode="-1" /&gt;
      &lt;error statusCode="404" prefixLanguageFilePath=""
          path="/problem.html" responseMode="ExecuteURL" /&gt;
      &lt;remove statusCode="500" subStatusCode="-1" /&gt;
      &lt;error statusCode="500" prefixLanguageFilePath=""
          path="/problem.html" responseMode="ExecuteURL" /&gt;
  &lt;/httpErrors&gt;
  </code></pre>
  
  <p>Unfortunately, while the correct error page is displayed, instead of a returning a 404 a 200 is returned, and a 302 followed by a 200 is returned for 500 errors.</p>
  
  <p>For older versions of IIS, or those not running in Integrated mode, you could set <code>redirectMode="ResponseRewrite"</code> on the <code>customErrors</code> element and that would resolve this issue.</p>
  
  <p>I've tried setting <code>existingResponse</code> on <code>httpErrors</code> to all three available options, as well as tried updating setting <code>responseMode="File"</code>, but these changed nothing.</p>
  
  <p>Is there any way to do something similar for the <a href="https://www.iis.net/configreference/system.webserver/httperrors" rel="nofollow"><code>httpErrrors</code> element</a>? Or am I stuck with pointing the errors to an ASP.NET page and returning the appropriate error from there?</p>
  
  <p>Thanks!</p>