Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client variable explanation

Status
Not open for further replies.

ketankshah

IS-IT--Management
Jan 11, 2001
121
IN
I have 2 questions:-

If on client's browser cookies are disabled -

1. Can I use session variables ?

2. Can I use client variables ?

If yes, then how?

Ketan
 
Hey Ketan,

You can use session and client variables but you must pass the cfid & cftoken variables to each script with the use of url variables. You must also pass them through form submissions as well. Here are two examples of how your links and forms must be set.

<a href=&quot;newPage.cfm?cfid=#cfid#&cftoken=#cftoken#&quot;>New Page</a>

<form method=&quot;post&quot; action=&quot;newPage.cfm?cfid=#cfid#&cftoken=#cftoken#&quot;>

You can't pass them as hidden form variables and you can't have any regular html pages as these can't pass the cfid/token and will cause the session to get lost.

Hope this helps,
GJ
 
Thanks.

One more query.

How can I use client variables through database? In this case should I pass cfid and cftoken if cookies are disabled?

Ketan
 
Hey ketankshah,

It's been a busy week over here. Storing the client variables in a database won't make any difference to your code. Just code it normally and you can switch the storage to the database if you need.

Hope this helps,
GJ
 
just to butt-in...

i have an app that refers to cookies throughout. only now have i realised that some people on the intranet dont allow cookies.

so is it true to say that so long as i include the url querystring indicated above the (cookie)session variables will still be ok throughout - i.e. i dont have to remove all my
Code:
xx = cookie.xxValue
Mark Saunders :)
 
Hey Mark,

As long as you pass the cfid & token values as shown above, your app will still work with client and session variables. Cookie variables are stored and sent by the browser and CF doesn't do anything other than pass these on to your script. Therefore, you will not be able to access these if they have cookies turned off even if you pass the cfid/token combo since these are only used for session/client variables.

Hope this helps,
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top