• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

SESSION variables across subdomains. How to make them visible?

New Here ,
Jun 17, 2011 Jun 17, 2011

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!

Views

6.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 17, 2011 Jun 17, 2011

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#">

Votes

Translate

Translate
Guide ,
Jun 17, 2011 Jun 17, 2011

Copy link to clipboard

Copied

Not a problem!

My invoice is in the post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 09, 2011 Sep 09, 2011

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 17, 2011 Jun 17, 2011

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#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jun 17, 2011 Jun 17, 2011

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)#">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 17, 2011 Jun 17, 2011

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".

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation