Copy link to clipboard
Copied
Hi everybody!
I have a website and for some reasons, many subdomains, as part of the same website. Some kind of mainstore.com and phones.mainstore.com, laptops.mainstore.com, and so on.
The problem I am facing is I can't make SESSION variables (and COOKIES) visibile between them. If I login from the first page (mainstore.com) everything is ok, but if I then navigate to phones.mainstore.com, the website is showing me I am not logged in, of course, because SESSION variable used to check if a user is logged in or not is not visible on that subdomain.
I read a lot of articles about this problem, some of them are offering solutions but none worked for me.
Here are the facts:
ColdFusion 9 Enterprise
Windows Server 2008
IIS7
And this is my <CFAPPLICATION> statement:
<CFAPPLICATION NAME="appName" CLIENTMANAGEMENT="No" SETCLIENTCOOKIES="Yes" SETDOMAINCOOKIES="Yes" SESSIONMANAGEMENT="Yes" SESSIONTIMEOUT="#CreateTimeSpan(0, 0, 20, 0)#">
Do you have any idea how to make SESSION variables and COOKIES visible between all subdomains of the same domain?
Thank you!
Do it manually and tell us what happens. To do it manually, set setClientCookies to "no" and then use this code
<cfcookie name="CFID"
domain=".viaromania.eu"
value="#session.cfid#">
<cfcookie name="CFTOKEN"
domain=".viaromania.eu"
value="#session.cftoken#">
<cfcookie name="JSESSIONID"
domain=".viaromania.eu"
value="#session.sessionid#">
Copy link to clipboard
Copied
Not a problem!
My invoice is in the post
Copy link to clipboard
Copied
It works like a charm No matter if you are on http://cazare-brasov.viaromania.eu or http://bilete-avion.viaromania.eu you are logged in
Topic closed!
Copy link to clipboard
Copied
Do it manually and tell us what happens. To do it manually, set setClientCookies to "no" and then use this code
<cfcookie name="CFID"
domain=".viaromania.eu"
value="#session.cfid#">
<cfcookie name="CFTOKEN"
domain=".viaromania.eu"
value="#session.cftoken#">
<cfcookie name="JSESSIONID"
domain=".viaromania.eu"
value="#session.sessionid#">
Copy link to clipboard
Copied
No matter if setClientCookies is set to YES or NO, your code is returing this error: "Element CFID is undefined in SESSION."
Here is my application settings.
<CFAPPLICATION NAME="appName" CLIENTMANAGEMENT="No" SETCLIENTCOOKIES="Yes" SETDOMAINCOOKIES="Yes" SESSIONMANAGEMENT="Yes" SESSIONTIMEOUT="#CreateTimeSpan(0, 0, 20, 0)#">
Copy link to clipboard
Copied
MacLaeod wrote:
No matter if setClientCookies is set to YES or NO, your code is returing this error: "Element CFID is undefined in SESSION."
Here is my application settings.
<CFAPPLICATION NAME="appName" CLIENTMANAGEMENT="No" SETCLIENTCOOKIES="Yes" SETDOMAINCOOKIES="Yes" SESSIONMANAGEMENT="Yes" SESSIONTIMEOUT="#CreateTimeSpan(0, 0, 20, 0)#">
I have only just read that you are using J2EE session management. Then you should have ignored session.CFID and session.CFTOKEN, and only used
<cfcookie name="JSESSIONID"
domain=".viaromania.eu"
value="#session.sessionid#">
However, you still have to set setClientCookies to "No".