iamkillyou
Programmer
Does anyone know how to create a java object in a cfscript block that will write a cookie?
I ask this because in my application I want to read or set, read to verify that I wrote one and increment a unique visitor counter.
The problem is the cookie scope - even if the visiting browser has cookies blocked CF is still reading the cookie scope, not the actualy cookie, resulting in an always true condition.
Normally this can be done in two templates, but since everyone comes into my site view different pages I have to do it in application.cfm.
I suppose I could use javascript to set the cookie, but I'd like to have a completley seerver side solution.
So my thoughts are to create the cookie in java something like this: (which I can't get to work)
Any one have a clue how this could be done, and if it would be outside coldfusions cookie scope if it is done?
My website, or a bad habit?
BarSmart
I ask this because in my application I want to read or set, read to verify that I wrote one and increment a unique visitor counter.
The problem is the cookie scope - even if the visiting browser has cookies blocked CF is still reading the cookie scope, not the actualy cookie, resulting in an always true condition.
Normally this can be done in two templates, but since everyone comes into my site view different pages I have to do it in application.cfm.
I suppose I could use javascript to set the cookie, but I'd like to have a completley seerver side solution.
So my thoughts are to create the cookie in java something like this: (which I can't get to work)
Code:
<cfscript>
response = CreateObject("java", "java.lang.String");
myCookie = new Cookie("myVar","test"));
myCookie.setMaxAge(50000);
response.addCookie(myCookie);
</cfscript>
Any one have a clue how this could be done, and if it would be outside coldfusions cookie scope if it is done?
My website, or a bad habit?
BarSmart