Force a 404 error with coldfusions CFHEADER?

Here is what im looking for...

I already setup IIS to redirect my 404 errors to a page i created called redirect.cfm.  What redirect.cfm does is see where the user said they wanted to go, and try to figure out where they need to be.

If it knows where to send them I use the CFLOCATION tag to send them on their way.

If it cannot figure out what the user wants, it executes the CFHEADER tag like below:

<cfheader statuscode="404" statustext="The page cannot be found" />

In Internet Explorer, I am getting the standard 404 error page... however in netscape all I get is a blank white page.  Is there a better way I should be handling this so that the 404 is being properly received?

Best Regards,
LVL 10
Who is Participating?
I wear a lot of hats...


I just happened to be playing with utl_tcp from Oracle the other day to my cold fusion server. The funny thing was, when I specified a 'bad' page, The cold fusion server was actually sending all that text that you see in IE when a page is not found. I'm thinking that that 'stuff' doesn't necessarily come from the browser, but actually comes from the server, not sure at all though.  It was interesting to me though that the page came down from the server, it definitely wasn't the browser generating it as I was a straight TCP socket at that point, not a browser.

I wonder if IE isn't providing the page if it isn't provided from the server when it gets a 404, but netscape isn't.  I wonder if, when you do the 404, you shouldn't also output a page that indicates what the problem is too.

Just a thought based on my strange, strange learnings with tcp communications with the web server.  I was really surprised that I got an entire page send down with the 404.
If you want, I can post the actual data that came down the pipe, but it was quite extensive.  Included Javascript and everything.
js_vaughanAuthor Commented:
I assumed all the error pages were generated on the client's end.
For example, on my Windows XP, all the error pages produced by all of my browers are located at C:\WINDOWS\Help\iisHelp\common

Also, if coldfusion was sending that information, why would it only send it to IE?
Netscape, Opera, and Firefox all produce blank pages with my cfheader tag.

When i test a similar bad request on another one of my servers (where I have not altered IIS) they all produce the errors correctly.

So it seems to me my cfheader tag is not getting the job done right here.  That is where i need the help.
I understand. I thought it was always generated on the client side too.  I was very surprised to see it being dumped down the pipe, but it was. This is theory, I've not tested it. I suspect that if you go to a bad webpage and the server is handling it, it is sending down the data, regardless of client. BUT, since you forced the 404, and a page was found on the cold fusion side, it didn't send down the data.

The reason, again theorization, that you see it in IE is that it IS generating it on the client side if the server doesn't provide it.  Try sending down page data too and see how it goes.

Experts Exchange Solution brought to you by

Your issues matter to us.


Start your 7-day free trial
js_vaughanAuthor Commented:
Sorry for the bad rating.  I resolved this problem some time ago.  I cant even remember how I solved it but it was unrelated to the proposed solution.

Thank you for your time though.
Web Servers

From novice to tech pro — start learning today.