Search code examples
htmlasp.netiiserror-handlinghttp-status-code-404

HTTP Error 404.0 (Error Code 0x80070002) - IIS 10, .NET 4.0


I have an issue with my default error page. Currently, it keeps displaying the following error. The custom error HTML page file is in the same folder as the web.config, I have tried changing the directory of the error page HTML but the results were the same. However, what confuses me is the fact that I was able to run the error page on another local server, but I wasn't able to get the HTML error page on the server with the web.config configurations.

I have tried the following changes to my web.config file. However, none of them worked.

Added to web.config the following codes:

<modules runAllManagedModulesForAllRequests="true">
<validation validateIntegratedModeConfiguration="false" />
 <remove name="UrlRoutingModule"/>

Attached is the error code and the configurations image I have. (I removed the following configurations as mentioned above as they did not work) Please do leave your suggestions and tips, thank you!

Error Code


Solution

  • I had dug deeper and realized that my code was wrong. I tried using the httpsError attribute errorMode= "DetailedLocalOnly" which resulted in this error. The correct value for this attribute should be errorMode= "Custom"

    More information about the attribute can be found here https://learn.microsoft.com/en-us/iis/configuration/system.webserver/httperrors/