Reputation: 2143
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?
Upvotes: 3
Views: 3785
Reputation: 2143
Just had to change the errorMode attribute of the httpErrors node from Detailed to Custom.
From:
<httpErrors errorMode="Detailed">
to:
<httpErrors errorMode="Custom">
Upvotes: 2
Reputation: 10839
I blogged about this. You probably are not setting your web.config correctly. Read my post to learn how to do it. You need this in your system.webserver node.
<httpErrors existingResponse="PassThrough" />
http://blog.aquabirdconsulting.com/2012/04/19/setting-up-asp-net-mvc-error-pages/
Upvotes: 1