Skip to content

Instantly share code, notes, and snippets.

@fernandezja
Last active January 4, 2024 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fernandezja/494e2448228decca3b5d8c6509a0a7c1 to your computer and use it in GitHub Desktop.
Save fernandezja/494e2448228decca3b5d8c6509a0a7c1 to your computer and use it in GitHub Desktop.
ASP.NET Core / NET 8 Custom HTTP Error Pages
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\WebApp1.exe"
stdoutLogEnabled="false"
stdoutLogFile=".\logs\stdout"
hostingModel="inprocess"
disableStartUpErrorPage="true" />
<httpErrors errorMode="Custom" defaultResponseMode="File">
<remove statusCode="500" subStatusCode="-1" />
<error statusCode="500" path="500.htm" />
</httpErrors>
</system.webServer>
</location>
</configuration>
<!--
aspNetCore > disableStartUpErrorPage = true
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/web-config?#attributes-of-the-aspnetcore-element
httpErrors >
https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/
-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment