Setup: ColdFusion MX, Session variables enabled in ColdFusion administrator, IE6.0 w/ Accept All Cookies set, MS Windows XP Professional
Problem: Name and Role attributes set in cfloginuser are not remembered on pages other than the login page as evidenced by GetAuthUser and IsUserInRole functions not working as expected. This problem occurred in all 3 of the following cases: (1) Application.cfm file with CFAPPLICATION tag with sessionmanagement set to "yes" (2) same as (1) but "no" (3) no Application.cfm file and no CFAPPLICATION tag. Other people at my company have not had this problem. The program below or one very similar worked on another person's machine w/ the same software.
Code:
Application.cfm file:
page1.cfm file:
page2.cfm file:
Problem: Name and Role attributes set in cfloginuser are not remembered on pages other than the login page as evidenced by GetAuthUser and IsUserInRole functions not working as expected. This problem occurred in all 3 of the following cases: (1) Application.cfm file with CFAPPLICATION tag with sessionmanagement set to "yes" (2) same as (1) but "no" (3) no Application.cfm file and no CFAPPLICATION tag. Other people at my company have not had this problem. The program below or one very similar worked on another person's machine w/ the same software.
Code:
Application.cfm file:
Code:
<cfapplication name="testingCflogin" sessionmanagement="yes">
page1.cfm file:
Code:
<html>
<head>
</head>
<body>
<h3>Testing cflogin</h3>
<!--- debugging --->
<cfoutput>
Debugging:<br>
Before login (i.e cfloginuser):<br>
GetAuthUser() returns: "#GetAuthUser()#"<br>
IsUserInRole("corpAdmin") returns: #IsUserInRole("corpAdmin")#<br>
IsUserInRole("officeAdmin") returns: #IsUserInRole("officeAdmin")#<br>
IsUserInRole("employee") returns: #IsUserInRole("employee")#<br>
<br><br>
</cfoutput>
<!--- This block executes only if user has *not* logged in --->
<cflogin>
<!--- Tell ColdFusion to consider user to be logged in --->
<cfloginuser
name="vwatts"
password="wrotciv"
roles = "corpAdmin">
</cflogin>
<!--- debugging --->
<cfoutput>
Debugging:<br>
After login:<br>
Attribute settings in cfloginuser:<br>
Name=vwatts<br>
Password=wrotciv<br>
Roles=corpAdmin<br>
GetAuthUser() returns: "#GetAuthUser()#"<br>
IsUserInRole("corpAdmin") returns: #IsUserInRole("corpAdmin")#<br>
IsUserInRole("officeAdmin") returns: #IsUserInRole("officeAdmin")#<br>
IsUserInRole("employee") returns: #IsUserInRole("employee")#<br>
<br>
</cfoutput>
<cflocation url="page2.cfm">
</body>
</html>
page2.cfm file:
Code:
<html>
<head>
</head>
<body>
<cfoutput>
Debugging:<br>
After login:<br>
Attribute settings in cfloginuser:<br>
Name=vwatts<br>
Password=wrotciv<br>
Roles=corpAdmin<br>
GetAuthUser() returns: "#GetAuthUser()#"<br>
IsUserInRole("corpAdmin") returns: #IsUserInRole("corpAdmin")#<br>
IsUserInRole("officeAdmin") returns: #IsUserInRole("officeAdmin")#<br>
IsUserInRole("employee") returns: #IsUserInRole("employee")#<br>
<br>
</cfoutput>
<cflogout>
</body>
</html>