Skip to main content
Inspiring
August 1, 2008
Question

Application.cfc Error?

  • August 1, 2008
  • 6 replies
  • 729 views
Application.cfc file is causing trouble ?

I am just defining variables like this: in the OnApplicationStart

<cffunction name="onApplicationStart" output="false">
<cfset webmaster = "webmaster <mail.domain.com>">
<cfset MailServer = "mail.domain.com">
<cfset w = "webmaster@domain.com">
<cfset pass = "hashed">
<cfset companyname = "duly Parted">
<cfscript>
application.dsn = "conference";
</cfscript>
<cfreturn true>
</cffunction>

I am trying to send email but it says #pass# is undefined.

I hardcoded the values and they worked, but when i try running it from the application.cfc, they generate an error:

Is something wronh i am doing?


This topic has been closed for replies.

6 replies

Inspiring
August 1, 2008
To expand on Davern's answers, your problems were caused by setting local variables instead of session variables. When you changed the function to scope those variables, nothing happened because the onApplicationStart method had already run.

There are a number of ways to handle this. The one Davern's suggested is as good as any.
Inspiring
August 1, 2008
to set your vars in the application scope you have to set them as
application.yourvarname, like Daverms said and like you are setting your
DSN var in the code you posted. to use these vars you have to call them
as application.yourvarname as well.

you have to restart your app after you make the changes to
application.cfc's onAplicationStart method, or reinitiate the
application manually without restarting the app by calling the
onApplicationStart method.

hth

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Inspiring
August 1, 2008
this does not work
Inspiring
August 1, 2008
Hi,

Are you able to see the application.pass variable in the dump?... If it is not listed there, then try renaming your application name in the <cfapplication> tag and have a re-run.
Inspiring
August 1, 2008
Hi,

Try setting your "pass" variable as a application variable by prefixing it as,
Application.pass (or) this.pass that might work.

Inspiring
August 1, 2008
no the variable does not pass like this,
but it show me some basic info like:

component MS.Application
SETCLIENTCOOKIES yes
SCRIPTPROTECT all
SETDOMAINCOOKIES no
SESSIONMANAGEMENT yes
APPLICATIONTIMEOUT 0.0416666666667
NAME MS
LOGINSTORAGE session
CLIENTMANAGEMENT yes
SESSIONTIMEOUT 0.0138888888889
METHODS
Inspiring
August 1, 2008
Hi

Does your variable (i.e. pass) get listed when you dump your application scope like this,

<cfset app = createObject("component", "Application")>
<cfdump var="#app#">