What error did it give? Is it possible you're missing
sessionmanagement="yes" in your <cfapplication> tag? It is definitely
possible to set session variables inside CFCs, however as Dave Watts
mentioned earlier it's better practice to not directly write to
persistent scopes from a CFC.

A possible solution could be to save your login variables to the
variables scope within the CFC (local CFC variables), then put your CFC
in the session scope and call methods in it instead of accessing
session.auth.

Hope that helps,
Kam 

-----Original Message-----
From: Web Specialist [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 26, 2004 11:13 AM
To: CF-Talk
Subject: Create session scope inside CFC - it's possible?

Hi

How to assign session values wuth an structure like this inside an CFC:
security.cfc

<cfcomponent>
<cffunction access="public" name="authentication" output="0">
<!--- security authentication function --->
<!--- username and password required ---> <cfargument name="cfcLogin"
type="string" required="1"/> <cfargument name="cfcPassword"
type="string" required="1"/>

<cfquery name="getUserAuth" ...../>

<CFSET Session.Auth=StructNew()>
<CFSET Session.Auth.LoggedIn="Yes">
<CFSET Session.Auth.UserID=getUserAuth.strUserID>
<CFSET Session.Auth.Name=getUserAuth.strUserName>
<CFSET Session.Auth.Roles=ValueList(getUserAuth.rolesID)>
<CFSET Session.Auth.RolesGrouped=ValueList(getUserAuth.roles_grouped)>
<CFSET Session.Auth.Roles2=ValueList(getUserAuth.roles)>        
<CFSET Session.Auth.RolesDescr=ValueList(getUserAuth.rolesdescr)>

and return all that Session values to all my application?

Call CFC:

<cfif structKeyExists(form,"checkAuth")>
<!--- The user pressed the authenticate button ---> <cfinvoke
component="security" 
method="authentication" 
returnVariable="authentictedSN" 
cfcLogin="#form.Login#" 
cfcPassword="#form.Password#">
</cfif>

<cfdump var="#Session#"> give an error....

Thanx in advance



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=38

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182667
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to