troubleshooting Question

question regarding application.cfc

Avatar of Coast Line
Coast LineFlag for Canada asked on
Web ServersWeb Development SoftwareColdFusion Language
15 Comments4 Solutions407 ViewsLast Modified:
Hi experts. I have the following application.cfc, but when i login my session does not get populated, i am using the following code:

<cffunction verifyclient="yes" name="onApplicationStart" output="false">
  <cfset Application.configured = 1>
  <cfset Application.datetimeConfigured = TimeFormat(Now(), "hh:mm tt") & "  " & DateFormat(Now(), "mm.dd.yyyy")>
  <cfset Application.currentSessions = 0>
  <!--- Application Addresses --->
  <cfset setLocale("English (US)")>
  <!--- Set the session page encoding --->
  <cfset setencoding("URL", "utf-8")>
  <cfset setencoding("Form", "utf-8")>
  <cfcontent type="text/html; charset=utf-8">
  <cfreturn True>
</cffunction>
<cffunction verifyclient="yes" name="onSessionStart" returntype="void">
  <cfset Session.StaffAuth = StructNew()>
  <cfset Session.StaffAuth.IsLoggedIn = false>
  <cfset Session.StaffAuth.StaffID = "">
  <cfset Session.StaffAuth.StaffName = "">
  <cfset Session.StaffAuth.StaffPermissions = "">
  <cfset Session.SuccessMsg = "">
  <cfset Application.sessionTracker = #StructNew()#>
</cffunction>
<cffunction verifyclient="yes" name="onSessionEnd" returntype="void">
  <cfargument name="SessionScope" required="true">
  <cfscript>
      StructClear(session);
      StructClear(cookie);
      </cfscript>
</cffunction>

Also my this:

<cfset setLocale("English (US)")>
  <!--- Set the session page encoding --->
  <cfset setencoding("URL", "utf-8")>
  <cfset setencoding("Form", "utf-8")>
  <cfcontent type="text/html; charset=utf-8">

is correct or not as i have added in Application.cfc file


below is the login.cfm page code:

<cfif login.RecordCount EQ 1>
      <cfif login.Disabled IS 0>
        <cfset ErrorMsg = "You account is currently inactive.">
        <cfset ErrorFlag = true>
        <cfelse>
        <cflock scope="session" type="exclusive" timeout="10">
          <cfset Session.StaffAuth = StructNew()>
          <cfset Session.StaffAuth.IsLoggedIn = true>
          <cfset Session.StaffAuth.StaffID = login.ID>
          <cfset Session.StaffAuth.StaffName = "#login.nadmin# #login.pwd#">
          <cfset Session.StaffAuth.StaffPermissions = login.role>
          <cfset Session.SuccessMsg = "">
          <!--- Declare variable in session scope for later use --->
        </cflock>
blah blah extra code goes down under.......
ASKER CERTIFIED SOLUTION
duncancumming

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 4 Answers and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 4 Answers and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros