View Full Version : 404 error page won't show include files...

08-13-2005, 03:38 PM
My web host has designated 404.asp as the default 404 error page. This page has a couple of includes like this:

<!--#include file="includes/navigation.inc"-->

...however they are not displaying. If you view the source, you can see that it isn't parsing. Any idea why?


08-13-2005, 06:08 PM
Have you tried using an absolute path to the include file? This would mean putting a forward slash before the directory name so that whichever directory the page is in that pulled the 404 error will look to the root directory then to the includes directory for the file navigation.inc
something like this

<!--#include file="/includes/navigation.inc"-->

08-13-2005, 06:21 PM
Nope, that doesn't work. I've also tried the full url.

I wonder if having the .asp extention is screwing things up?

08-13-2005, 06:34 PM
No. The file extension shouldnt matter. Try putting the code below into the 404.asp page and then navigate to a page that doesn't exist. try navigating to a few different nonexistant pages in different directories. You can then see if it is changing the path

Response.Write Request.ServerVariables("PATH_INFO")

PS the include file is placed outside of the asp delimiters correct?

08-13-2005, 09:14 PM
Hi and thank for helping!

I've placed this <% Response.Write Request.ServerVariables("PATH_INFO") %> into 404.asp and it is not parsing. When you view the source of the page, you actually see <% Response.Write Request.ServerVariables("PATH_INFO") %>

I don't understand why other asp pages/scripts will run fine...maybe that's why I assumed it was a setting in IIS perhaps?

08-13-2005, 09:24 PM
that tells me the page is running as an .htm/html page and not an .asp page perhaps it was originally 404.htm and then was saved as 404.asp but instead of saving it with the proper extension it saved it as 404.asp.htm try deleting the page from the server and replace it with a page with the proper extension

08-13-2005, 09:42 PM
This is just WIERD! I removed 404.asp from the server AND made certain there wasn't a page entitled 404.htm or 404.html...there wasn't (not even with a hidden attribute).

I then uploaded 404.asp and same thing...asp code or includes refuse to parse. If you think I've reached an impasse from this side, what should I ask the host?

08-14-2005, 07:29 PM
It sounds like the hosting company has some setting that is treating the 404 page like it is an .htm and not an asp page. Definately something you need to speak to them about.

08-15-2005, 04:28 AM
I'll do that, thanks for all the help!