Hi, Can anyone help me with this?
I'm developing an app on my local PC (using PWS) but the app will be published on the web. This app will be one of several on the web site, so I want to use CFCOOKIE's PATH attribute to group cookies by app. So I need to specify the PATH attribute.
The trouble is that if I use the DOMAIN attribute (with or without PATH) my cookies don't get set. If I omit the DOMAIN attribute my cookies work but I can't use PATH to group them by app.
The PWS "site" does not have a full web domain name but appears in the browser address bar as and the CF diagnostic output shows CGI.HTTP_HOST=phil
(I understand that LANs behave in the same way, i.e. they show as e.g.
I inserted some debug output lines and they show what I expected, i.e. the code seems to be doing what I intended (whether that's right is another matter):
App.cfm:
Application.CookieDomain = |.phil|
Application.CookiePath = |/development/app1|
(I use | as a delimiter on debug output)
My development configuration is:
CF 4.0.1
Win 98 with PWS
I use this code in Application.cfm to set up the DOMAIN and PATH values:
<cfset Application.AppTopDir = "app1">
<cfif NOT IsDefined("Application.CookiePath">
<cfset PathLen = Find(Application.AppTopDir, Cgi.PATH_INFO) + Len(Application.AppTopDir) - 1>
<cfset Application.CookiePath = Left(Cgi.PATH_INFO, PathLen)>
</cfif>
<cfset Application.CookieDomain = "." & Cgi.HTTP_Host>
and this code in OnRequestEnd.cfm to set a cookie:
<cfcookie name="CookieOK" value="y" domain="#Application.CookieDomain#" path="#Application.CookiePath#" secure="no">
(I've also tried setting the cookie in other places and it still doesn't work if I specify DOMAIN)
Can anyone suggest how I can set cookies with Domain & Path in my development environment?
Thanks,
Phil
I'm developing an app on my local PC (using PWS) but the app will be published on the web. This app will be one of several on the web site, so I want to use CFCOOKIE's PATH attribute to group cookies by app. So I need to specify the PATH attribute.
The trouble is that if I use the DOMAIN attribute (with or without PATH) my cookies don't get set. If I omit the DOMAIN attribute my cookies work but I can't use PATH to group them by app.
The PWS "site" does not have a full web domain name but appears in the browser address bar as and the CF diagnostic output shows CGI.HTTP_HOST=phil
(I understand that LANs behave in the same way, i.e. they show as e.g.
I inserted some debug output lines and they show what I expected, i.e. the code seems to be doing what I intended (whether that's right is another matter):
App.cfm:
Application.CookieDomain = |.phil|
Application.CookiePath = |/development/app1|
(I use | as a delimiter on debug output)
My development configuration is:
CF 4.0.1
Win 98 with PWS
I use this code in Application.cfm to set up the DOMAIN and PATH values:
<cfset Application.AppTopDir = "app1">
<cfif NOT IsDefined("Application.CookiePath">
<cfset PathLen = Find(Application.AppTopDir, Cgi.PATH_INFO) + Len(Application.AppTopDir) - 1>
<cfset Application.CookiePath = Left(Cgi.PATH_INFO, PathLen)>
</cfif>
<cfset Application.CookieDomain = "." & Cgi.HTTP_Host>
and this code in OnRequestEnd.cfm to set a cookie:
<cfcookie name="CookieOK" value="y" domain="#Application.CookieDomain#" path="#Application.CookiePath#" secure="no">
(I've also tried setting the cookie in other places and it still doesn't work if I specify DOMAIN)
Can anyone suggest how I can set cookies with Domain & Path in my development environment?
Thanks,
Phil