Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Can't make custom 404 error page work

New Here ,
Jan 26, 2009 Jan 26, 2009
Running CF Server MX 7.02

I have redone the site at q10.ca and have tons of non existant *.cfm pages. After changing the default 404 error page in IIS, no matter what I do, I cannot get rid of the default 'Error Occurred While Processing Request ' box that is the default for CF errors. I can get the 404 custom page for any non-existant '.htm. pages, but not '.cfm' pages. I have tried quite a few things:

- change settings in adminstration settings for CF server
- added code to Application.cfm:
<cferror type = "exception"
exception = "Any"
template = "404.cfm"
mailto = "replies@mparam.com">

<cffunction name="onMissingTemplate" returnType="boolean">
<cfargument type="string" name="targetPage" required=true/>
...
<cfreturn BooleanValue />
</cffunction>

- created an Application.cfc file with the same code

All I want to do is simply redirect every error for a missing page to the same page and after 3 hours I still can't seem to accomplish this simple task.

Regards, Chris
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 26, 2009 Jan 26, 2009
if you have a wildcard application map setup for your cf site in IIS,
then you need to select 'Verify that file exists' for that map instead
of for .cfm file:

on the Mappings tab, see if you have an entry in the 'Wildcard
application maps' section and if you do, select that map and click
'Edit...' button next top it, then select the 'Verify that file exists'
checkbox.

as for Missing template handler in cf admin - it is a global setting for
cf server. it is NOT site-specific. thus if you define...
Translate
Explorer ,
Jan 26, 2009 Jan 26, 2009
Christina,

Have you tried the process outlined here:

http://www.bennadel.com/blog/108-Using-ColdFusion-to-Handle-404-Errors-Page-Not-Found-On-Development...

Sorry if you have, but I have to check!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2009 Jan 26, 2009
Thanks Jamie,

No I didn't see that, but it does look promising. After I try to fix something else I seem to have broken on the site, I will turn to that and see if I can make it work and report back. Thanks very much!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2009 Jan 26, 2009
Jamie,

Ironically we have been looking at your site recently.

Anyway, I quickly tried that cferror.cfm file, placed it in the root andthen tried a non-existant '.cfm' file and had no joy.

From the page you referred me to:
quote:

On your live, production server, you can set up custom 404 handling on a site-by-site basis via IIS custom error templates.


I'm not sure what the above means. I actually set up that custom handling in IIS on our server for that site, but saw no results on '.cfm' pages, only '.htm' pages work.

I keep getting the feeling that I'm really complicating something that should be extremly simple.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 26, 2009 Jan 26, 2009
My remote access isn't working right so I can't test this on any of the dev servers I have in the office. If no one else has any ideas before tomorrow afternoon I'll run some tests and get back to you then with the results.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2009 Jan 26, 2009
Thanks Jamie.

One thing that I was looking at but couldn't get a handle on. In the Server Administrator Interface there is a 'missing template handler' field. However if I entered the name of 404.cfm in there, it rejected it. Obviously I don't know how to handle that field. Can that field be used to solve my problem if I were to place a 404.cfm in every CF Site?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 26, 2009 Jan 26, 2009
you can also try this:

- Got to IIS Management Console
- Expand your Websites
- Right-click on your website and select 'Properties'
- Select the 'Home Directory' tab
- Click the 'Configuration...' button
- On the 'Mappings' tab in the Application Configuration pop-up, select
".cfm" under Application extensions
- Click 'Edit...' button
- Select the 'Verify that file exists' check box

this will make IIS check that requested .cfm page actually exists on the
server, before passing the processing of the page to CF, and if it does
not IIS will display the custom 404 page you have defined in it for this
website.

the downside of this, iirc, is that you can't use CF Mappings... but i
may be wrong on this one, as i do not actually use this 'Verify that
file exists' setting on any of my CF sites...

were you on CF8, you could use the onMissingTemplate() method in
Application.cfc to display a custom 404.cfm page (or do whatever else
you wnat to do when a page does not exist)


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2009 Jan 26, 2009
Thanks Azadi,

Earlier I was poking around in IIS wondering if I could do something along those lines. So, as I believe all the old mappings are not being used anymore, I went ahead andgave it a try, I think I could live with that solution if I could make it work. I stopped ans started the website in IIS after I finished. But regreattably, noting seemed to change.

I'm wondering if anyone can elaborate on what the 'missing template handler' field does in CF Administrator and if anything can be done there?

As a last resort I was thnking about trying to find the error text for that page and at least editing it in the short term with links to the home pages.

Thanks again.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 26, 2009 Jan 26, 2009
if you have a wildcard application map setup for your cf site in IIS,
then you need to select 'Verify that file exists' for that map instead
of for .cfm file:

on the Mappings tab, see if you have an entry in the 'Wildcard
application maps' section and if you do, select that map and click
'Edit...' button next top it, then select the 'Verify that file exists'
checkbox.

as for Missing template handler in cf admin - it is a global setting for
cf server. it is NOT site-specific. thus if you define it, ALL you cf
sites on the same cf server/instance will have the same 404 page.


Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 26, 2009 Jan 26, 2009
Thanks Azadi,

I was just playing with that field in the Administrator Settings and having problems with the paths when your note came in. I did as you suggested, and was happy to see that finally it works.

Curiously though, it now defaults to 'Index.cfm' in the root of the site rather than '404.cfm' that I had stipulated in the custom errors field in IIS. So I'm thinking I must have set 'Index.cfm' perhaps in the global IIS settings or somewhere else.

If I'm thinking correctly then, this would only disable CF Mappings for this site and not all the sites wouldn't it?

Thanks again, even if I can't get it to go to '404.cfm', it's a huge improvement!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 27, 2009 Jan 27, 2009
Christina Garibaldi wrote:
>
> I'm wondering if anyone can elaborate on what the 'missing template handler'
> field does in CF Administrator and if anything can be done there?
>


The challenge with the 'missing template handler' is that it does not
work as many would expect it to with web site web roots. A little
understood fact of ColdFusion servers is that they often have *two* web
roots, especially the Java flavors such as 'Multi-home' and 'J2EE'.

For example, the IIS web root for one of my web sites on our multi-home
ColdFusion development server is at 'D:\\playground\. But the
ColdFusion server also uses the
'E:\JRun4\servers\playground\cfusion.ear\cfusion.war\'.

It is the latter directory that a 'missing template handler' or 'server
wide exception handler' must live in. I do not fully understand this,
but it is the only way I have ever been able to make these work.

HTH
Ian

P.S. Since ColdFusion will look in it's web root before it looks into
the web site's web root for any file, a wicked way to drive a coworker
crazy is to put an index.cfm file with some mean message in it inside
the ColdFusion's web root. It could take them weeks to find out what is
going on and you can watch how fast their hairline recedes during the
search.

P.P.S No I have never done this, but I do think about it once in a while
when frustrated. :)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 27, 2009 Jan 27, 2009
LATEST
Thanks Ian,

Your post reminds me of my dad recounting a story of back in the keypunch and card reader days, at Uni, slipping a poem on comment cards onto the bottom of a programming job and then removing it before they cards were picked up, so the poem would appear on the bottom of the printout. That's how he tried to get dates aparently.

Thanks for the comment, I was reading another post last night similar to what you were saying when Azadi's suggestion worked.

The only weird thing I have now is the default error page seems to be 'Index.cfm', when in fact I have a URL mapping of '/404.cfm' designated in the Custom Errors window of IIS for that site. '/404.cfm' is in the root of the site just like Index.cfm is. Must be some kind of gremins similar to what you mention at work with this as well.

Thanks for the comments, think I will simply stay away from the missing template handler.

Edit: Just solved the problem mentioned above. '404.cfm' still had some code in it that CF did not like. As soon as I removed the bad code, '404.cfm' started to work as it should. Now everything is as it should be. Thanks again to everyone for all the assistance, now I'm back to where I left off 24 hrs ago, finally....
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources