Thanks Charlie, let me answer your questions below. (long answer warning!)
> Mischa, when your first note mentioned you were use this "as a missing template handler", I assumed that you were referring to the Admin console configurable setting. ** Correct, CF admin -> Server Settings -> Settings -> Missing Template Handler. Now you mention using the application.cfc. ** That was Teddy's suggestion. Since I'm in the dark on this issue, I'm trying everything folks tell me ;) I just want to make sure that these are unrelated in your mind (as I don't believe that the application.cfc does missing template handling, just as CFERROR does not). ** From what I can see, you're right. Also, the existence of application.cfc prevents application.cfm running, doesn't it? So you want to remove that if it was just some kind of test. ** If I understand correctly, it is suggested to use application.cfc instead of application.cfm on MX7, which is what I have been doing. I have never had an application.cfm. So, just to be clear, you are confident that the error handler is being triggered by the admin setting pointing to it, but when it does it fails if you refer to an application variable. ** Positive. That would seem to suggest that it simply isn't running the application.cfm. It should, I'd think, but I don't know for sure. First things first: if you enable debugging, do you in fact see that it does not run the application.cfm? ** Ok, I think there are 4 situations: 1. request non-existing html file, request app var: application.cfc is executed, app var is returned, page-not-found.cfm executed properly. 2. request non-existing html file, do not request app var: application.cfc is executed, app var not requested, page-not-found.cfm executed properly. 3. request non-existing cfm file, request app var: application.cfc is not executed, app var is not returned, page-not-found.cfm does not execute properly. 4. request non-existing cfm file, do not request app var: application.cfc is not executed, app var is not requested, page-not-found.cfm executed properly. BTW, I'm relying on the Execution Times section of my debug window to determine whether application.cfc is executed or not. If it's still not clear, rather than dump the application scope (as you did in your original note), try dumping the variables scope (<cfdump var="#variables#">) Assuming you have no other vars being set in the error handler, you should see a dump of the empty variables struct. Then, in the application.cfm, do a <cfset name="bob">, and rerun the request, to see if the CFDUMP now shows the variable. ** Ok, I added this extra variable in a cfset to my application.cfc -> onRequestStart and restarted the CF service. If it doesn't, then it clearly isn't running the application.cfm. ** When I do <cfdump var="#variables#"> as a first thing on page-not-found.cfm scenario 1: struct [empty], app var is outputted, extra var is not dumped scenario 2: struct [empty], extra var is not dumped scenario 3: dump of the CFERROR and ERROR structs (nothing else) and then the core file not found error, extra var is not dumped scenario 4: dump of the CFERROR and ERROR structs (nothing else), extra var is not dumped The thing that I don't understand: application vars are loaded in the memory of the CF server when the application starts, so my application.cfc shouldn't even *have* to be loaded for them to be available during every page request, right? Hope this helps! Mischa. Maybe someone else can tell if this jibes with their experience. I just hadn't noticed before (and can't at the moment set up tests to confirm). /charlie -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mischa Uppelschoten ext 10 Sent: Wednesday, May 10, 2006 9:13 AM To: [email protected] Subject: re[2]: [ACFUG Discuss] Missing template handler does not have access to application scope? Thanks Charlie and Teddy! Sorry for the delay. I tried your suggestions and moved my page-not-found.cfm to the root of my website and also wrote a simple onError event handler in my application.cfc: <cffunction name="onError" returntype="void"> <cfargument name="Exception" required=true/> <cfargument name="EventName" type="String" required=true/> in Application.cfc: onError </cffunction> Unfortunately, this doesn't change anything: page-not-found.cfm is executed correctly as long as I don't read any application vars, but throws a "core" file not found error when I do. It seems the onError event is never fired at all. BTW, in IIS I have set the 404 error page to also point to page-not-found.cfm. This page IS executed correctly, including a read from an application var when a user requests anything but a cfm file. The CF application log shows 3 lines: Exception thrown by error-handling template: Element SITEROOT is undefined in APPLICATION. The specific sequence of files included or processed is: D:\mysite\Page-not-found.cfm File not found: /mysite/catal.cfm The specific sequence of files included or processed is: d:\mysite\catal.cfm Mischa. > Might it be that your page-not-found.cfm is located at a directory > level other than where your code live? In which case it may not benefit from the application.cfm you'd have there, which is doing the CFAPPLICATION tag that enables the application scope? If that's the case, either move the page-not-found.cfm into the same directory as code you expect to have those variables or put a CFAPPLICATION with the same NAME into the page-not-found.cfm or an application.cfm in its directory or parent. Hope that helps. /charlie -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mischa Uppelschoten ext 10 Sent: Friday, May 05, 2006 2:26 PM To: [email protected] Subject: [ACFUG Discuss] Missing template handler does not have access to application scope? Trying to get "page-not-found.cfm" as a missing template handler to work in CFMX7. When I request a non existing cfm page foo.cfm this code in page-not-found.cfm is executed fine: <cfset request.txt="Page not found"> <cfoutput> #request.txt# </cfoutput> This does not work fine: <cfset request.txt="Page not found"> <cfoutput> #request.txt# </cfoutput> <cfdump var="#application#"> CF will display the text "Page not found" in the browser, but will then generate the default "Error Occurred While Processing Request", complaining that the foo.cfm file could not be found. I rely on my application variables for displaying my standard site layout, so at this moment I'm unable to properly format a page not found error. Any suggestions? Thanks! Mischa. -------------------------------------------------------- * To unsubscribe from this list, manage your profile @ * * http://www.acfug.org?fa=gin.edituserform * * * * For more info, see http://www.acfug.org/mailinglists * -------------------------------------------------------- -------------------------------------------------------- * To unsubscribe from this list, manage your profile @ * * http://www.acfug.org?fa=login.edituserform * * * * For more info, see http://www.acfug.org/mailinglists * -------------------------------------------------------- < Mischa Uppelschoten The Banker's Exchange, Inc. 2020 Hills Avenue NW Atlanta, GA 30318 Phone: (404) 605-0100 ext. 10 Fax: (404) 355-7930 Web: www.BankersX.com Follow this link for Instant Web Chat: http://www.bankersx.com/Contact/chat.cfm?Queue=MUPPELSCHOTEN -------------------------------------------------------- * To unsubscribe from this list, manage your profile @ * * http://www.acfug.org?fa=gin.edituserform * * * * For more info, see http://www.acfug.org/mailinglists * -------------------------------------------------------- -------------------------------------------------------- * To unsubscribe from this list, manage your profile @ * * http://www.acfug.org?fa=login.edituserform * * * * For more info, see http://www.acfug.org/mailinglists * -------------------------------------------------------- < Mischa Uppelschoten The Banker's Exchange, Inc. 2020 Hills Avenue NW Atlanta, GA 30318 Phone: (404) 605-0100 ext. 10 Fax: (404) 355-7930 Web: www.BankersX.com Follow this link for Instant Web Chat: http://www.bankersx.com/Contact/chat.cfm?Queue=MUPPELSCHOTEN -------------------------------------------------------- * To unsubscribe from this list, manage your profile @ * * http://www.acfug.org?fa=login.edituserform * * * * For more info, see http://www.acfug.org/mailinglists * --------------------------------------------------------
