IIS8.5 > Sites > mysite > Error Pages > 404
-
Select "Insert content from static file into the error response".
-
Uncheck "Try to return the error file in the client language".
-
Enter path to "notfound.html", I've verifieed it is there.
When I visit a page I know isn't there I get:
The page cannot be displayed because an internal server error has occurred.
Why aren't I getting my custom 404 file?
I don't think it's a permission thing, I've tried moving "notfound.html" to several places, one of which is the actual site wwwroot folder which serves the rest of the site.
Best Answer
This error is generated because an absolute path is detected in
web.config
.Absolute physical path (like
C:\path\to\notfound.html
) is not allowed insystem.webServer/httpErrors
section inweb.config
file.Now you have 2 solutions :
1. Allow physical path in
ApplicationHost.config
fileBy default this file is located in
%SystemRoot%\system32\inetsrv\config
Locate this file and Edit it
Search for section
<httpErrors ..... >
Then add directive
allowAbsolutePathsWhenDelegated="true"
, like the following :Save the file, should work !
2. Use relative path
Relative path means that you will have to store your custom error pages in the root folder of the given Web Site.
Then, go to
IIS > Sites > mysite > Error Pages > 404
And setup your custom error page like this :
Click
OK
, should work !EDIT :
However, note that :
404 Not Found
response200 OK
response