Getting default 404 error page for unknown file extension even with custom 404 error page

iis-7.5

Solution

Just had to change the errorMode attribute of the httpErrors node from Detailed to Custom.

From:

<httpErrors errorMode="Detailed">

to:

<httpErrors errorMode="Custom">

Problem

We have set a custom 404 error page in order to display a 'nice' page instead of the default IIS page. When trying to access a non existing page with a known file extension (e.g. http://mydomain/dumb.aspx), the custom 404 page gets displayed. When trying to access a file with an unknown file extension (e.g. http://mydomain/index.dumb), the default 404 error page gets displayed. What puzzles me is that the IIS Web core is handling the error: ModuleName: IIS Web Core Notification: 16 HttpStatus: 404 HttpReason: Not Found HttpSubStatus: 0 ErrorCode: 2147942402 ConfigExceptionInfo : Notification: MAP_REQUEST_HANDLER ErrorCode: The system cannot find the file specified. (0x80070002) But the configured custom error page is note taken into account: ``` <httpErrors errorMode="Detailed"> <remove statusCode="404" subStatusCode="-1" /> <error statusCode="404" prefixLanguageFilePath="" path="/httpError" responseMode="ExecuteURL" /> </httpErrors> ``` We do have handler mappings for * but not for . . Could it be the cause of the issue? What would be the correct configuration?

Original source