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

We set a custom 404 error page to display a β€œnice” page instead of the default IIS page.

If you try to access a non-existing page with a known file extension (for example, http: //mydomain/dumb.aspx ), a user page 404 will be displayed.

When you try to access a file with an unknown file extension (for example, http: //mydomain/index.dumb ), a page with a default error of 404 is displayed.

What puzzles me is that the IIS kernel handles the error:

Module name: IIS Web Core
Notice: 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 user error page is taken into account in a note:

 <httpErrors errorMode="Detailed">
    <remove statusCode="404" subStatusCode="-1" />
    <error statusCode="404" prefixLanguageFilePath="" path="/httpError" responseMode="ExecuteURL" />
</httpErrors>

We have handler mappings for *, but not for., Could this be the cause of the problem? What will be the correct configuration?

+3
source share
2 answers

It was just necessary to change the errorMode attribute of httpErrors node from verbose to custom.

From:

<httpErrors errorMode="Detailed">

at

<httpErrors errorMode="Custom">
+3
source

. , web.config. , , . system.webserver node.

<httpErrors existingResponse="PassThrough" />

http://blog.aquabirdconsulting.com/2012/04/19/setting-up-asp-net-mvc-error-pages/

+1

All Articles