Alan,
Thanks, I will give client vars a try. I still think cfcache may lose state
of the client variable just like it does for cookies and sessions.
I will let you know how it goes.
RM
>From: "McCollough, Alan" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>Subject: RE: CFCACHE and checking for session.MyArray[2]
>Date: Thu, 6 Jul 2000 07:20:04 -0800
>
>IMHO, I'd do two things...
>
>Numba 1: Use structures instead of arrays. Structures will provide you with
>a much more logical way of working user data. Fer instance... You have
> <CFSET Session.UserInfo[1] = "#return_db_fields#">
> <CFSET Session.UserInfo[2] = "#return_db_fields1#">
> <CFSET Session.UserInfo[3] = "#return_db_fields2#">
> <CFSET Session.UserInfo[4] =
>"#qryFnameLnameEmail.FirstName#">
> <CFSET Session.UserInfo[5] =
>"#qryFnameLnameEmail.LastName#">
> <CFSET Session.UserInfo[6] = "#qryFnameLnameEmail.Email#">
> <CFSET Session.UserInfo[7] = "#qryFnameLnameEmail.Username#">
>With structures, you could say
><CFSCRIPT>
> Session.UserInfo=StructNew();
> StructInsert(Session.UserInfo, "return_db_fields",
>"#return_db_fields#");
> StructInsert(Session.UserInfo, "return_db_fields1",
>"#return_db_fields1#");
> StructInsert(Session.UserInfo, "return_db_fields2",
>"#return_db_fields2#");
> StructInsert(Session.UserInfo, "FirstName", "#FirstName#");
> StructInsert(Session.UserInfo, "LastName", "#LastName#");
> StructInsert(Session.UserInfo, "Email"", "#Email#");
> StructInsert(Session.UserInfo, "Username", "#Username#");
>
></CFSCRIPT>
>
>Okay, now to go full hog-wild... Numba 2.
>I converted many of my apps from using session variables over to using
>client variables that reside in a database instead of the Registry. Why?
>Well, one good reason is cuz' you can query the database to see the exact
>contents of a client variable, so you can tell the state of a variable
>instantly. This makes debugging SoOoOo much easier. You won't have to do as
>much guessing about the state of stuff like "is this array initialized?".
>You can just look in the database and see for yourself.
>
>Details are available from a few sources...
>Marc Funaro has a great article in the June 2000 CFDJ on this topic.
>I've also got an instruction sheet on passing complex variables
>(structures,
>arrays) into database-driven client variables by using WDDX, you can see it
>at http://www.anthc.org/skunkworks.
>
>Yeah yeah I'm talking about a major re-engineering of how your app is put
>together. But I do believe the time invested would pay off fast. Once you
>get hooked on looking in the database right at the variables, hey, you'll
>wonder why you waited so long.
>
>Had to throw in my 32 cents worth here...
>
>Alan McCollough
>Web Programmer
>Alaska Native Medical Center
>
> > -----Original Message-----
> > From: CM Randall [SMTP:[EMAIL PROTECTED]]
> > Sent: Wednesday, July 05, 2000 4:24 PM
> > To: [EMAIL PROTECTED]
> > Subject: CFCACHE and checking for session.MyArray[2]
> >
> > I'm caching a page using CFCACHE, but in order to view the page the user
> > has
> > to have access. In the application page I have it check if the user is
> > logged in, if not then I send them to the login page.
> >
> > Application.cfm
> > <cfif NOT IsDefined("Session.UserInfo")>
> > <cfif cgi.PATH_INFO contains "AlertArchive">
> > <cflocation url="Login/Login.cfm" addtoken="No">
> > </cfif>
> > </cfif>
> >
> >
> > Once they are logged in I set an Array of their information and I put
>that
> >
> > into a session.
> >
> > login.cfm
> > <CFSET Session.UserInfo = ArrayNew(1)>
> > <CFSET Session.UserInfo[1] = "#return_db_fields#">
> > <CFSET Session.UserInfo[2] = "#return_db_fields1#">
> > <CFSET Session.UserInfo[3] = "#return_db_fields2#">
> > <CFSET Session.UserInfo[4] = "#qryFnameLnameEmail.FirstName#">
> > <CFSET Session.UserInfo[5] = "#qryFnameLnameEmail.LastName#">
> > <CFSET Session.UserInfo[6] = "#qryFnameLnameEmail.Email#">
> > <CFSET Session.UserInfo[7] = "#qryFnameLnameEmail.Username#">
> >
> >
> > On the page I am caching, at the top I check to see is
>session.MyArray[2]
> > is
> > valid. It seems to be looping back because the session is valid but
>then
> > throws an error.
> >
> > Caching page
> > <cfif Session.UserInfo[2] LTE "1">
> > Sorry you don't have access
> > <cfabort>
> > </cfif>
> >
> > That doesn't work! The value of the user I was test was 2, so it I did
> > this
> > Session.UserInfo[2] LTE "2" it would work (weird).
> >
> > So then, I created a page that will determine if the the
> > session.MyArray[2]
> > is defined, if it is I include the cached pages, otherwise I include a
> > page
> > that displays no access. This doesn't work either, the server just
>hangs
> > as
> > if it is still looking. I entered #session.MyArray[2]# with no CFOUTPUT
> > and
> > did find it diplayed twice.
> >
> > Page to determine if they have access:
> > <cfif IsDefined("Session.UserInfo")>
> > <cfinclude template="Module/Module.cfm">
> > <cfelse>
> > <cfinclude template="NoAccess.cfm">
> > </cfif>
> >
> > Any idea why this is not working?
> >
> > All I want to do is have them login, and if they have the correct access
> > number let them view the cached page.
> >
> > Thanks,
> > RM
> >
> >
> >
> >
> > ________________________________________________________________________
> > Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
> >
> >
>--------------------------------------------------------------------------
> > ----
> > To Unsubscribe visit
> > http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox
>or
> > send a message to [EMAIL PROTECTED] with 'unsubscribe'
>in
> > the body.
>------------------------------------------------------------------------------
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com
------------------------------------------------------------------------------
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/fusebox or send a
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.