thanks, it was a typo here only - just to show cfapplication tag
Main Topics
Browse All TopicsI've built a login framework using CFLOGIN. I'm having a problem (as are many people I've seen) where even though the user has logged out <CFLOGOUT>, they're roles seem to be cached the next time even though they're prompted to log back in. I've been researching this for 3 days and have tried every combination. Could someone look at my cfapplication tag and logout.cfm code and give me feedback? I think I'm confident in what is in the CFLOGIN, pretty basic, and I didn't want to take up too much space by entering everything here but if you need more information please let me know.
How do you test what information is cached in HTTP Header?
Is it true that CFLOGOUT only clears what is entered in CFLOGINUSER?
cfapplication.cfm
<!--- used 2 minutes here for testing purposes only --->
<CFAPPLICATION Name="xxx"
applicationtimeout="#creat
sessiontimeout="#createtim
sessionmanagement="yes"
clientmanagement="yes"
setclientcookies="yes"
Clientstorage="Cookie">
<cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN"
<cfset localCFID=Cookie.CFID>
<cfset localCFTOKEN=Cookie.CFTOKE
<cfcookie name="CFID" value="#localCFID#">
<cfcookie name="CFTOKEN" value="#localCFTOKEN#">
</cfif>
logout.cfm
<cflock timeout=20 scope="Session" type="Exclusive">
<cfset structclear(cookie)>
<cfset session.isloggedin = "no">
<cfset StructDelete(session, "CFID")>
<cfset StructDelete(session, "CFTOKEN")>
<cfset StructDelete(session, "URLToken")>
<cfset StructDelete(session, "SessionID")>
<cfset StructDelete(session, "UserLogin")>
<cfset StructDelete(session, "UserPassword")>
<cfset StructDelete(session, "emp_id")>
</cflock>
<CFLOGOUT>
<cflocation url="index.cfm">
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
And then what is the point of this code:
<cfif IsDefined("Cookie.CFID") AND IsDefined("Cookie.CFTOKEN"
<cfset localCFID=Cookie.CFID>
<cfset localCFTOKEN=Cookie.CFTOKE
<cfcookie name="CFID" value="#localCFID#">
<cfcookie name="CFTOKEN" value="#localCFTOKEN#">
</cfif>
Basically if both of the cookies are defined then you go ahead and copy to a local variable and then copy back to the same cookie...
Why not just use the cookies that you know exisst?
Also I do not see anywhere where you are using cflogin
Since that is where the problem is coming from where is that code?
I apologize if it seems as if I haven’t provided enough information, I didn’t want to overload the page with code. I thought that the cflogin was solid, however everything is now attached below. 1. application.cfm, 2. onrequestend.cfm, 3. logout.cfm
I deleted the cfcookie code in application.cfm. Original idea was a last attempt at trying to delete cookies – if that was the problem behind user’s roles being cached.
application.cfm:
<!--- DEFINE THE FOLLOWING VARIABLES WHEN SETTING UP THE APPLICATION:--->
<cfsetting showDebugOutput="Yes">
<cfset DataSource = "xxx">
<!--- Name the application, enable application variables --->
<CFAPPLICATION Name="Main"
applicationtimeout="#creat
sessiontimeout="#createtim
sessionmanagement="yes"
clientmanagement="yes"
setclientcookies="yes"
Clientstorage="Cookie">
<cflogin idletimeout="120">
<CFIF NOT (IsDefined("Form.UserLogin
<cfinclude template="userloginform.cf
<cflock timeout=20 scope="Session" type="Exclusive">
<cfset session.isloggedin = "no">
</cflock>
<cfabort>
</cfif>
<cfquery name="GetUser" datasource="#xxx#" username="#Form.UserLogin#
Select sysdate
From dual
</cfquery>
<CFIF GetUser.RecordCount EQ 1>
<cflock scope="session" type="Exclusive" timeout="10">
<cfset session.isloggedin = "yes">
</cflock>
<!--- Enable roles for current user's session Only--->
<cfquery name="EnableRoles" datasource="#xxx#" username="#Form.UserLogin#
Set Role All
</cfquery>
<cfquery name="GetUserRoles" datasource="#xxx#" username="#Form.UserLogin#
Select Granted_Role
From USER_ROLE_PRIVS
</cfquery>
<!--- Retrieve employee id number --->
<cfquery name="GetUserID" datasource="#xxx#" username="#Form.UserLogin#
Select userid, emp_id, system_id
From accounts
Where userid = '#UCase(FORM.UserLogin)#'
</cfquery>
<!--- set session variables --->
<cflock scope="session" type="Exclusive" timeout="20">
<cfset session.UserLogin = Form.UserLogin>
<cfset session.UserPassword = Form.UserPassword>
<cfset session.emp_id = GetUserID.emp_id>
<cfset session.roles = ValueList(GetUserRoles.Gra
</cflock>
<CFLOGINUSER name="#Session.UserLogin#,
<!--- Otherwise, re-prompt for a valid username and password --->
<CFELSE>
Sorry, the username and/or password is not recognized. <cfoutput><A HREF="#CGI.SCRIPT_NAME#">P
<cfabort>
</CFIF>
</CFLOGIN>
<!--- end of application.cfm --->
Onrequestend.cfm
<cfoutput>
<cfif #session.isloggedin# IS "yes">
<p>You are currently logged in, <a href="logout.cfm">log out</a></p>
<cfelse>
<p>You are currently logged out, <a href="../index.cfm">log back in</a></p>
</cfif>
</cfoutput>
<!--- end of Onrequestend.cfm --->
Logout.cfm:
<cflock timeout=20 scope="Session" type="Exclusive">
<cfset StructClear(Cookie)>
<cfset session.isloggedin = "no">
<cfset StructDelete(session, "CFID")>
<cfset StructDelete(session, "CFTOKEN")>
<cfset StructDelete(session, "URLToken")>
<cfset StructDelete(session, "SessionID")>
<cfset StructDelete(session, "UserLogin")>
<cfset StructDelete(session, "UserPassword")>
<cfset StructDelete(session, "emp_id")>
</cflock>
<CFLOGOUT>
<cflocation url="../index.cfm">
<!--- end of logout.cfm --->
The cfloginuser needs to be enclosed in cflogin tags.
http://livedocs.macromedia
Or since you are writing most of it yourself anyway you may want to manually write the login/logout code
See this tutorial:
http://cfhub.com/examples/
Business Accounts
Answer for Membership
by: mrichmonPosted on 2004-09-30 at 15:08:53ID: 12195178
One probelm. Your file should be Application.cfm NOT cfapplication.cfm