[英]CFERROR causing browser to display Coldfusion source code
When there is an exception error Coldfusion will throw in the error. 当出现异常错误时,Coldfusion将抛出错误。 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: 但是由于我想同时捕获这两者,所以我输入type =“ request”可以捕获两者:
<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! 问题是当我输入type =“ request”并发生异常时,将显示exception.cfm,并在浏览器的源代码视图中显示所有Coldfusion源代码! It works fine if I put type="exception". 如果我输入type =“ exception”,效果很好。 This is very weird and I don't expect CF code to show in browser no matte what, but it does. 这很奇怪,我不希望CF代码在浏览器中显示无遮罩的内容,但确实如此。 Is this some CF Admin settings issue or a CF9 bug? 这是某些CF管理员设置问题还是CF9错误?
You cannot use CFML tags when the error type is Request . 错误类型为Request时,不能使用CFML标签。 That is why your ColdFusion source code is being displayed in the browser. 这就是为什么您的ColdFusion源代码在浏览器中显示的原因。 But when the error type is Exception , you can use CFML tags, functions. 但是,当错误类型为Exception时 ,可以使用CFML标签,函数。 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. 通过Request类型,您可以使用9个CFML Error
变量(例如Error.Diagnostics
,并用数字#号将它们Error.Diagnostics
起来。 To know more, see cferror documentation 要了解更多信息,请参阅cferror文档。
I hope this helps you. 我希望这可以帮助你。 :) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.