Highlighted

Lost sessions after upgrading from CF8 to CF10

Contributor ,
Oct 28, 2014

Copy link to clipboard

Copied

We have an internal page that we use to control things on our website.  It's sort of like a home-brewed CMS, but it doesn't hold actual content.  It just stores details about the pages (page title, contact person, date created, etc) and allows us to show newly added items on a "what's new" page.

To get into the thing, I have a list of authorized users in a database.  I compare this list to a function that the server gives us called GetAuthUser()

I basically do a query to find that username in the database and pull out the associated rights, then assign them to session variables.  This worked perfectly in CF8, but not in CF10.

Here's the code that worked before:

<cffunction name="onSessionStart">

    <cfquery name="session.userdata" datasource="mydsn">

    SELECT usernm, user_email, admin

    FROM users

    WHERE usernm = '#listlast(GetAuthUser(),"\")#'

    </cfquery>

    <cfif session.userdata.recordcount eq 0>

        <cflocation url="noaccess.html" addtoken="no">

    <cfelse>

        <cfset session.rights = session.userdata.admin>

        <cfset session.email = session.userdata.user_email>

    </cfif>

</cffunction>

Any ideas why it blows up in CF10?  I get the dreaded "Element RIGHTS is undefined in SESSION." deal.

Views

357

Likes

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

Lost sessions after upgrading from CF8 to CF10

Contributor ,
Oct 28, 2014

Copy link to clipboard

Copied

We have an internal page that we use to control things on our website.  It's sort of like a home-brewed CMS, but it doesn't hold actual content.  It just stores details about the pages (page title, contact person, date created, etc) and allows us to show newly added items on a "what's new" page.

To get into the thing, I have a list of authorized users in a database.  I compare this list to a function that the server gives us called GetAuthUser()

I basically do a query to find that username in the database and pull out the associated rights, then assign them to session variables.  This worked perfectly in CF8, but not in CF10.

Here's the code that worked before:

<cffunction name="onSessionStart">

    <cfquery name="session.userdata" datasource="mydsn">

    SELECT usernm, user_email, admin

    FROM users

    WHERE usernm = '#listlast(GetAuthUser(),"\")#'

    </cfquery>

    <cfif session.userdata.recordcount eq 0>

        <cflocation url="noaccess.html" addtoken="no">

    <cfelse>

        <cfset session.rights = session.userdata.admin>

        <cfset session.email = session.userdata.user_email>

    </cfif>

</cffunction>

Any ideas why it blows up in CF10?  I get the dreaded "Element RIGHTS is undefined in SESSION." deal.

Views

358

Likes

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
Oct 28, 2014 0
Contributor ,
Oct 28, 2014

Copy link to clipboard

Copied

Ok, it turns out that my problem was that the old session had not expired, and it probably didn't help that I had a crashed copy of Firefox in the background.  Once the old session cleared, everything suddenly worked.

Now on to the next error, which is with cfdirectory.  Wish me luck!

Likes

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
Reply
Loading...
Oct 28, 2014 0
LEGEND ,
Oct 28, 2014

Copy link to clipboard

Copied

What issue are you experiencing with CFDIRECTORY?

Likes

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
Reply
Loading...
Oct 28, 2014 0
Contributor ,
Oct 28, 2014

Copy link to clipboard

Copied

The fact that our CMS and the development server are now on totally different machines.

Likes

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
Reply
Loading...
Oct 28, 2014 0
LEGEND ,
Oct 28, 2014

Copy link to clipboard

Copied

It's been a while since I tried to browse directories on another system.  I think CFFTP might be able to do it.

YUP!!  As long as the credentials are good, you can use CFFTP to browse directories on another machine.

Adobe ColdFusion 9 * cfftp: Connection: file and directory operations

Likes

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
Reply
Loading...
Oct 28, 2014 0
Contributor ,
Oct 28, 2014

Copy link to clipboard

Copied

Ideally, yes, but I think that you have to have CF running under a user account to do that, and we don't.  I think as the system account, you don't have rights to do a remote read.

Likes

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
Reply
Loading...
Oct 28, 2014 0
LEGEND ,
Oct 28, 2014

Copy link to clipboard

Copied

CFFTP has user and password attributes that should log on to any proper FTP user account.

Likes

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
Reply
Loading...
Oct 28, 2014 0
Contributor ,
Oct 28, 2014

Copy link to clipboard

Copied

I'm gonna try to get the CMS moved to the machine where the files live before I start digging in too deep.  Fingers crossed!

Likes

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
Reply
Loading...
Oct 28, 2014 0
Contributor ,
Oct 29, 2014

Copy link to clipboard

Copied

Well as it turns out, my problem is not solved.  I logged back in this morning and the session amnesia is back.  I just don't get why I can't keep a session in CF10.

Likes

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
Reply
Loading...
Oct 29, 2014 0
Contributor ,
Oct 29, 2014

Copy link to clipboard

Copied

Setting this.setClientCookies = true seems to have fixed this.

For today at least.  As for tomorrow, who knows?

Likes

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
Reply
Loading...
Oct 29, 2014 0