OK guys... I think I have my Cookie kind of figured out now... 

It seems ASP does not actually store the cookie as complex variables but
instead it's more of a comma delimited format using "&" as the delimiter. 

Anyway now that I figure out that problem I have another... 

I am storing the values in the cookie like this: 
-----------------
<cfset Cookie_Value =
"NeedUpdate=0&Recognition=Support&EntityID=0000000009&AgentName=Neal+Bailey&
Region=XXXX&Rank=80&AgentNumber=%40%4009+">
<cfcookie name="Rsagent2" value="#Cookie_Value#">
------------------


But when I look at the cookie value it looks like this:
------------------
NeedUpdate%3D0%26Recognition%3DSupport%26EntityID%3D0000000009%26AgentName%3
DNeal%2BBailey%26Region%3DXXXX%26Rank%3D80%26AgentNumber%3D%2540%254009%2B
------------------

For some reason its converting the =,&,+ and % characters to another format.
Any idea how I can fix this?

Man what a mess... 

Thanks again..  

Neal Bailey
Internet Marketing Manager

-----Original Message-----
From: Mosh Teitelbaum [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 28, 2005 10:46 AM
To: CF-Talk
Subject: RE: CF Cookie & ASP Cookie?

Neal:

ASP supports something it calls a "Cookie Dictionaries."  This is,
essentially an associative array (or structure) of values all referenced by
the same variable name.  So, just like with ColdFusion structures you can do
something like:

        myStructure.myKey

in ASP, you can do something like:

        Response.Cookies("myStructure")("myKey")

In order to support this, ASP creates a cookie named "myStructure" (or
whatever you specify as the name) and sets the cookie value to something
like:

        key1=value1&key2=value2

So, to duplicate your ASP code in ColdFusion, you'll need code like the
following:

        <CFSET Value = "">
        <CFSET Value = Value & "AgentNumber=#AgentNumber#">
        <CFSET Value = Value & "&AgentName=#AgentFirst# #AgentLast#">
        <CFSET Value = Value & "&Rank=#CurrentRank#">
        <CFSET Value = Value & "&EntityID=#EntityID#">
        <CFCOOKIE NAME="RSHold" VALUE="#Value#" PATH="/" EXPIRES="Never">

Note that when you retrieve this Cookie via CF, you'll have to parse the
string and break it up into its original pieces.  You could use code like
the following:

        <CFSET RSHold = StructNew()>
        <CFLOOP LIST="#COOKIE.RSHold#" DELIMITERS="&" INDEX="Ele">
                <CFSET Key = ListGetAt(Ele, 1, "=")>
                <CFSET Value = ListGetAt(Ele, 2, "=")>
                <CFSET RSHold[Key] = Value>
        </CFLOOP>

And then access each piece via code like:

        RSHold["AgentNumber"]

Note, none of this code is tested so there might be some minor issues.  But
the logic should be pretty sound.

HTH

--
Mosh Teitelbaum
evoch, LLC
Tel: (301) 942-5378
Fax: (301) 933-3651
Email: [EMAIL PROTECTED]
WWW: http://www.evoch.com/


> -----Original Message-----
> From: Bailey, Neal [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, September 27, 2005 5:43 PM
> To: CF-Talk
> Subject: CF Cookie & ASP Cookie?
>
>
> Hey Guys I have been searching everywhere on this and I can't
> seem to figure
> this out. I am only familiar with using CF Cookies in the
> standard way but I
> have this asp site that I am having to port over to CF and I need to write
> cookies in CF much the same way we did using ASP. But it seems
> that with ASP
> you can give the Cookie a general name to refer to it by. But I
> am having a
> hard time figuring this out in CF or if it's even possible.
>
> Here is an example of our ASP Cookie...
>
>   Response.Cookies("RSHold")("AgentNumber") = RSAgent("AgentNumber")
>   Response.Cookies("RSHold")("AgentName") =
> RTrim(RSAgent("AgentFirst"))+ "
> " + RTrim(RSAgent("AgentLast"))
>   Response.Cookies("RSHold")("Rank") = RSAgent("CurrentRank")
>   Response.Cookies("RSHold")("EntityID") = RSAgent("EntityID")
>   Response.Cookies("RSHold").Path="/"
>
> I need to build this same Cookie using CF but cant figure it out. Am I
> missing something?
>
> This is what I have so far for CF but it's not the same...
>
> <cfcookie name="AgentNumber" value="#AgentNumber#" expires="now" path="/">
> <cfcookie name="AgentName" value="#AgentFirst# #AgentLast#" expires="now"
> path="/">
> <cfcookie name="Rank" value="#CurrentRank#" expires="#EntityID#"
> path="/">
>
> Any help on this would be grateful thanks.
>
> Neal Bailey
> Internet Marketing Manager
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219470
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to