How can I set custom 404 Error Handlers?

Custom 404's can be set for ASP and .NET sites by adding the below code to the bottom of the web.config file before the final </configuration>.

Classic ASP and Static Content
<configuration>
  <system.webServer>
         <httpErrors errorMode="DetailedLocalOnly" defaultResponseMode="ExecuteURL">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
         </httpErrors>
  </system.webServer>
</configuration>

.NET
<configuration>
  <system.web>
    <customErrors defaultRedirect="404.aspx" mode="DetailedLocalOnly">
      <error statusCode="404" redirect="404.aspx"/>
    </customErrors>
  </system.web>
</configuration>

  • 0 istifadəçi bunu faydalı hesab edir
Bu cavab sizə kömək etdi?

Related Articles

Setting Default Documents

If your site uses a default document that isn't configured on our system (e.g. default.html), you...