Cookies and multiple domains

Say just points to Then I have <cfcookie name="var1" value="value1" domain="">.
Obviously if someone visit, the cookie is not set. Now, if someone had visited and had the cookie set, what happens the next time they visit
I tried using <cfcookie name="var1" value="value1" domain=";"> but it does not recognise them. Is there something I am missing here? If so, please aid.
I also tried having <cfcookie name="var1" value="value1" domain=""> and <cfcookie name="var1" value="value1" domain=""> in one file, but it seems like the last cookie setting part is recognised.
Who is Participating?

Improve company productivity with a Business Account.Sign Up

dlewis9Connect With a Mentor Commented:
For security reasons, cookies can not be shared between different domains.

I believe the reason they provide the option to specify one or more domains is actually for when you are using subdomains, (ie:;

Are these domains for the same site?  I'd set up my server/code to have one domain redirect you to the other address when accessed..then you would only need one set of cookies and everyone would be browsing the site through the same address.
chadukaAuthor Commented:
Yeah, like I said in my question, they are the same site.

Ok, the setup is like this: name server has as the primary name, and as an alias for
On the webserver itself (WebSite Pro on WinNT), I have as the name of the server with the proper IP.
Tell me what happens if someone visits Do they get routed to I need technical details on how this all works.

this is done through DNS.  Your ISP probably hosts your DNS.  WHat happens is that both and have indivudal dns records.  For each of these domains they have a specific www record which points to a ip.  So what happens is that if you hit it transaltes this to an ip say now if you want to point to the same server you will update the www record to point to the same ip now you can refer to both requests using cookies and write only one cookie. Let me know if you have any more questions
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

chadukaAuthor Commented:
bigbadb, I understand that DNS setup. What I need to know is:
-- the webserver knows itself as
-- i write CF code and set my cookies on
-- someone in Republic of Neverland types in their browser, and hit the unresistable BIG key
-- will my cookies be set?
-- will the browser show (maybe in the URL field) the actual name

what you do to get around this is have a inital page which only has a redirect to your actual page.  THen you set the cookie here.  So index.html
would have a redirect to your actual this is where you start tracking cookies.  THen regardles of or org or net or cc you will be set
chadukaAuthor Commented:
.hmmm, so basically if they visit directly to another file without going to my start page, then I am dead?
you could prevent this by using session timeouts and forceing them to the main page if they hadnt visited the site lately.  Other than this it would probably be rare when a user would bypass your main page
.and that would be controlled in the application.cfm file.  It could look something like this:

<!--- Setup application with 1 hour sessions --->

<!--- Force user back to home page if not logged in --->    
<CFIF NOT IsDefined("Session.loggedin")>

chadukaAuthor Commented:
Comment accepted as answer
chadukaAuthor Commented:
Sorry, had almost forgotten about this.

Tx to all who gave suggestions.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.