选中rememberme按钮时,我具有以下功能来设置管理员cookie:
<!--- setRememberMeCookie() Method --->
<CFFUNCTION NAME="setRememberMeCookie" ACCESS="REMOTE" RETURNTYPE="BOOLEAN" DISPLAYNAME="setRememberMeCookie" HINT="Saves user login details to cookie">
<CFARGUMENT NAME="Usuario" TYPE="STRUCT" REQUIRED="YES">
<!--- Save the struct to a cookie --->
<CFSCRIPT>
adminStrc = Arguments.Usuario;
getPageContext().getResponse().addHeader("Set-Cookie", "name=#adminStrc.Nombre#; value=#adminStrc.Valor#; SECURE=yes; Max-Age=31622400; DOMAIN=eMercado.com; path=/Cookies; httponly=true" );
</CFSCRIPT>
<CFRETURN true>
</CFFUNCTION>
我正在尝试使用以下代码测试此功能:
<CFSCRIPT>
usuarioCookie = "#application.UsuarioCookie#"; //My Cookies Component
adminCookie = structNew();
adminCookie.Nombre = "Admin_Clave";
adminCookie.Valor = "2E372208-446D-57A5-07199C09B88DA458";
//To test the Cookie function
testCookie = usuarioCookie.setRememberMeCookie(adminCookie);
</CFSCRIPT>
<p><CFDUMP VAR="#testCookie#"> </p>
当我运行代码时,我收到以下错误:
元素 VALOR 在 ADMINSTRC 中未定义。
请让我知道我做错了什么?干杯。