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. Now you mention using the application.cfc. 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). 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.

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. 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?

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. If it doesn't, then it clearly isn't
running the application.cfm.

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: discussion@acfug.org
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: discussion@acfug.org
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 *
--------------------------------------------------------


Reply via email to