简体   繁体   English

CFERROR导致浏览器显示Coldfusion源代码

[英]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.

相关问题 导致代码飞跃的异常 - Exception causing a leap in code 是否需要禁用“启用稳健异常信息”才能使 cferror 正常工作? - Does “Enable Robust Exception Information” need to be disabled for cferror to work? 如何记录源代码行导致异常并添加自定义信息? - Howto log source line causing exception and add custom information? 我可以处理异常,然后继续执行而又不会导致代码中断吗? - Can I handle an exception and then let it continue on without causing a break in the code? 无法编译的源代码-未报告的异常java.lang.Exception; 必须被抓住或宣布被抛出 - Uncompilable source code - unreported exception java.lang.Exception; must be caught or declared to be thrown 如何将来自Browserify捆绑包的堆栈跟踪信息转换为原始源代码位置? - How do I translate stack traces from Browserify bundles to the original source code positions? 即使在C#代码中处理,InvalidOperationException也会导致Visual Studio中的中断 - InvalidOperationException causing break in Visual Studio even when handled in C# code File.Move是否引起TagetInvocationException? - File.Move Causing a TagetInvocationException? Coldfusion:如何处理cfftp异常 - Coldfusion: How to handle cfftp exceptions 如何从AggregatedException获取根导致异常 - How to get the root causing exception from an AggregatedException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM