【发布时间】:2010-07-15 17:24:20
【问题描述】:
我收到了这个错误
Element CUSTOMERID is undefined in CLIENT.
D:\Inetpub\wwwsitecom\wwwroot\rders.cfm:296
在以以下代码开头的页面上:
<cfif NOT CreateObject("component","User.User").IsLoggedIn()>
<script type="text/javascript">
window.location.href='/index.cfm';
</script>
<cfabort>
</cfif>
<cfif NOT IsDefined("client.customerid")>
<cfparam name="client.customerid" default="0">
<script type="text/javascript">
alert("We're sorry.");
window.location.href="/logout.cfm";
</script>
<cfabort>
</cfif>
在第 296 行
<cfinvoke component="Account" method="getAccessInfo" returnvariable="getInfo">
<cfinvokeargument name="customerid" value="#client.CustomerID#">
</cfinvoke>
IsLoggedIn 函数有这段代码
<cfif NOT StructKeyExists(client,"customerid")>
<cfset strIsLoggedIn = 0>
</cfif>
如果 ColdFusion 以线性方式处理脚本,如果不处理页面的第一部分,它如何到达第 296 行未定义的 client.customerid?
如果 ColdFusion 不能线性处理脚本,我该如何防止这个错误?
【问题讨论】:
-
可能需要使用您的一般调试技能来解决此问题。 CFDUMP 是你的朋友。
-
Henry,谢谢,有一个在错误时通过电子邮件发送的转储。它包括客户端范围的列表。整个客户端范围是空的。客户端里什么都没有!这也很奇怪,因为在第 296 行之前出现了对其他客户端变量的引用,它们同样受到错误的影响。
-
你可以试试:
吗?看看有没有效果 -
我认为顶部代码和第 296 行之间没有任何东西会以某种方式改变 ApplicationName,对吧?
-
您也可以尝试将
cfparam移出 - 及以上 -not isdefined条件。这就是cfparam的意义所在。然后更改条件以检查client.customerid eq 0。也许这种组合在某种程度上与客户端变量发生了冲突。
标签: coldfusion