简体   繁体   中英

CFERROR causing browser to display Coldfusion source code

When there is an exception error Coldfusion will throw in the error. I handle it with

<cferror
    template = "exception.cfm"
    type = "exception"
    mailTo = "webmaster@mydomain.com"> 

This works fine for "exception" errors. There is also the validation errors. But since I want to catch both I put type="request" which supposedly catches both:

<cferror
    template = "exception.cfm"
    type = "request"
    mailTo = "webmaster@mydomain.com"> 

The problem is when I put type="request" and an exception occurs, the exception.cfm is being displayed with all the Coldfusion source code showing in the browser's source code viewing! It works fine if I put type="exception". This is very weird and I don't expect CF code to show in browser no matte what, but it does. Is this some CF Admin settings issue or a CF9 bug?

You cannot use CFML tags when the error type is Request . That is why your ColdFusion source code is being displayed in the browser. But when the error type is Exception , you can use CFML tags, functions. Check out the documentation for more information.

With type Request , you can use nine CFML Error variables, such as Error.Diagnostics , by enclosing them with number # signs. To know more, see cferror documentation

I hope this helps you. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM