Application Variables in application.cfm and asp
If anyone could provide some insight into using application
variables declared in application.cfm, but retrieved in asp code,
it would be appreciated.
GOAL: Retrieve values into an asp page from application
variables in application.cfm.
PROCESS: Defined the variables in application.cfm. On an asp
page, defined the application variable in Window -> Bindings.
The application variables defined in the source code show up.
Attempt to retrieve the application variable in the asp page by
using the command: var_destination = Application("var_name")
It seems like whatever I try, the variable is empty. After
looking around on the web, I also saw that the equivalent to
application.cfm in asp is global.asa. I also tried setting up this
file, along with the variables, did the binding, and used the same
commands, and also was not able to retrieve any application
variables.
What am I missing?
What am I missing?
That ColdFusion and ASP.NET are different applications and do
not share
the same memory addresses So they are going to each have
their one
"application" variables.
Blue Dragon has implemented CFML as an ASP.NET language so
that one
could write ColdFusion that runs on the ASP.NET framework and
would then
use the same memory locations with their server.
Otherwise you are going to have to write your own sharing
tool. Some
code that can read the desired variables from one code base
and pass it
to the other code base through forms, web services or some
other manner.
Similar Messages
-
Application inside an application and using URL parameter to pass variable values
hello
My requirement is to create a design studio dashboard that will have 2 applications and I should be able to pass variable values from application 1 to application 2. All this should happen in 1 dashboard application. I have tried using open document functionality
Application1.openNewWindow(URL link to application 2) . It doesn't meet my requirement as I am required to login to the other application in a new window.
Is it possible to add 2 applications in one dashboard.
thanks,
BhatHi Bhat,
I don't know if it is possible to open it in the same Page. But you can try using the Opendoc Parameter which allows you to enable you to pass the credentials you have used in the current Dashboard.
A useful link,
https://help.sap.com/businessobject/product_guides/boexir4/en/xi4_opendocument_en.pdf
Regards,
Fazith Ali Z -
Difference between application.cfm and application.cfc
Hi,
Can anybody explain the difference between Application.cfm
and application.cfc?
For example:
I have Application.cfm and Application.cfc in the same
folder.
/folder/application.cfm
/folder/application.cfc
/folder /test.cfm
…. And I run the test.cfm.
Which one is executed first?
Thanks,
KrishnaYour last question - Which one is executed first?
The application.cfc will be executed first if you call the
test.cfm. The application.cfm will not get executed.
and, about ur first question... cfm and cfc are entirely
different. You have onRequestStart, onRequestEnd and other events
on cfc. cfc is powerful than cfm. -
How to Create and Use Application Variables in Java
I Have this need to have a common variable (Counter) for all the users(Sessions) accessing my Site witch is in JSP.
I think An Application Variable is the solution for my problem...
But I don't know how to use this. Even though I search the web for any tutorials or Examples could not fing any.
Could any one Please tell me or direct me to a site which has good information about this
Thanks In Advance!!!
Badsy.// get the application object
public class myServlet extends HttpServlet
public void doGet(HttpServletRequest req,
HttpServletResponse res)
ServletContext application = getServletContext();
} -
Problem with application-variables - CFLOCK?
Hi,
i have a problem with my application. It is a multi-user
application with 100 parallel-users and CFMX 7.
The problem wich occures is with application variables. These
are mainly structs wich get filled onApplicationStart(). The
problem is, that the variables suddenly disappear, they are empty.
I have read about CFLock and found out, that it is necesseary
to use cflock. And i found out, that onApplicationStart does
correct locking automatically. That is where i do not understand
the problem. The variables get intialized correctly and in further
they only get read-access. Why can they be corrupted?
My other question about that is, wheather i need cflock for
all Read-Access to Application and Session-Variables, even if there
happens no writing to the variables?
Best Regards,
Andreas> ?The element of position 2, of dimension 2, of an array
object used as part of
> an expression, cannot be found.?
> The array is in this case the struct.
Well, OK, that could be a problem. Arrays are not structs:
they are two
different things, are not interchangeable, and have
completely different
sets of functions to utilise them. You cannot treat a struct
as an array.
If CF is claiming your "struct" is an array, then it actually
*is* an
array, not a struct.
What's the line of code which is generating that error?
I suppose one could get this error if you have an array of
structs thus:
myArray
.key1
myArray.key2
(etc)
and you're trying to reference it with a numeric key rather
than by key
name, eg:
myArray
[n]
When n is an integer value, rather than a string (which
corresponds to the
name of the key).
> > Have you trapped the error, done a <cfdump>
of the application scope and
> > checked to see if it's the whole lot going awry, or
just some values?
> I have not used cfdump for it, because the server had to
be immediately
> restarted for our customers. But i think, that it is
not completely empty,
> because the index runs to pos2 of dimenstion2.
So does this not happen in your dev / testing environment?
> Will
> onApplicationStart() be called before? Or only if
onRequestStart() returns true?
I would ***-u-me that the application one would be called
before the
request one. It's pretty easy for you to test this though, I
should think?
(Sorry: for reasons beyond the scope of this conversation,
we're still
forced to use Application.cfm in our software, so I've only a
passing
knowledge of how Application.cfc works).
> Here is the code from onRequestStart()
> <cffunction name="onRequestStart"
returntype="boolean">
> <cfargument name="Requestedpage" required="yes" />
> <cfscript>
> var lFile = "/cargorent/Login.cfm";
> var iPosn = ListFindNoCase( lFile,
Arguments.Requestedpage );
> if( iPosn gt 0 )
> return true;
>
> if( NOT IsDefined( "session.user.Loginname" ) or
session.user.Loginname eq
> "" )
> {
> WriteOutput( "<p><p> The current user is no
longer valid, please log in
> again.</p></p>" & chr(10) & chr(13)
> WriteOutput( "<script
language=""javascript"">parent.location = ""
http://"
> & CGI.HTTP_HOST &
"/Login/Login.cfm"";</script>" );
> return false;
> }
>
> return true;
> </cfscript>
> </cffunction>
One thing I will say here is that I really think you should
be separating
your processing from your display. A function should do
processing. it
should pass that processing back to a CFM template which
should handle
whatever needs to be displayed on the browser. Although
that's nowt to do
with your current issue.
Adam -
Sometimes application variables don't reset
In our application.cfm, many queries are run and set to arrays that are application scope. They are for code tables. To keep all this from happenning each time a template runs, there is a server scope variable that is set to true from another program and in application.cfm, there is something like <cfif the server variable is true> run queries,assign arrays,set server variable to false </cfif>.
When a new code is added to a code table, we set the server variable to true and the next template that runs resets all the application variables and the new code is in one of them.
Sometimes this doesn't work. Only some of the arrays get reset and the others are empty. The arrays are there but have no elements.
Repeating the process 2 to 4 times seems to make it work.
What can cause it not to work the first time ?The problem happens even in a test area where I'm the only one using it.
Why does the reset program sometimes have to be run more than once ?
This is the reset program
server.x=0
This is what the application.cfm is like
<cfapplication name="thename">
<cfset ds="dsname">
<cfparam name=server.x type="boolean" default="0">
<cfif server.x eq 0>
<cfset server.x=1>
<cfset application.codes=arraynew(2)>
<cfquery name="qcodes" datasource="#ds#">
select codes, desc from tblcodes order by codes
</cfquery>
<cfloop query="qcodes">
<cfset application.codes[currentrow][1]=qcodes.code[currentrow]>
<cfset application.codes[currentrow][2]=qcodes.desc[currentrow]>
<cfset application.codes[currentrow][3]=qcodes.place[currentrow]>
<cfset application.codes[currentrow][4]=qcodes.date_eff[currentrow]>
<cfset application.codes[currentrow][5]=qcodes.date_del[currentrow]>
</cfloop>
does this for well over 50 more tables
</cfif> -
Are application variables 'user specific'?
hi - i've got a feeling i may have done something stupid.
we have several domains all pointing to one application.
in application we look at the cgi.http_host to work out which
site the domain the user is expecting and then serve up customised
content accordingly.
only this is i've set put the customised content in
application scoped vars - is that a bad move?
eg. in application.cfm i have:
<cfif cgi.http_host eq 'www.redredred.com' >
<cfset application.message= "welcome - we love the colour
red" >
<cfelseif cgi.http_host eq 'www.blueblueblue.com' >
<cfset application.message= "welcome - to our site where
we love blue" >
<cfelse>
<cfset application.message= "welcome to our site (we love
all colours)" >
</cfif>
then in the index.cfm:
<cfoutput>#application.message#</cfouput>
is there a chance that by doing this someone who has visited
www.redredred.com will get a message about blue?happysailingdude wrote:
>
> is there a chance that by doing this someone who has
visited www.redredred.com
> will get a message about blue?
>
Not only a chance, but there is something wrong if the person
does not
get this message, once the next user has set the variable to
blue.
Application variables are global to the application and will
be shared
by all users of that application. That is the designed and
desired
purpose of application variables.
In ColdFusion an application is defined by any template that
shares the
same 'name' as defined in either the name parameter of a
<cfapplication...> tag or the this.name property of an
Application.cfc file.
If all these web sites are using the same string for the
application
name then they share the same application scope and they will
all have
the same value for application.message. And this value will
be the
value set by the last visitor to any of the sites.
<cflock...> is not relevant to this issue. It will
prevent the variable
from being set at the exact same moment by multiple users on
multiple
sites, but it will not stop the value from changing
sequentially as
first one, then another user visits any of these sites and
changing the
value.
The solution to your problem is to set different application
scopes by
dynamically setting the application name. Thus each website
will be
separate and distinct applications with their own application
scope
variables and your system should behave the way desired. -
Application variables don't work!
I am using COLDFUSION MX 7.
There are 2 files:
Application.cfc
and
test.cfm
Application.cfc:
==================
<cfcomponent output="no" displayname="test">
<cfset THIS.name="test0">
<cfset application.testvariable="teststring">
</cfcomponent>
==================
Test.cfm
<cfdump var="#application.testvariable#">
RESULT
==================
Element TESTVARIABLE is undefined in APPLICATION.
QUESTION
==================
How do I use application variables?
Note: my Application file is a cfc not a cfm because I'm
trying to use MX 7 (and want to use functions such as onSessionEnd
etc.)
Thanking you in advance,
Mitja GiaconiQUESTION
==================
How do I use application variables?
Note: my Application file is a cfc not a cfm because I'm
trying to use
MX 7 (and want to use functions such as onSessionEnd etc.)
Good, then you can start by using onApplicationStart which is
the first
event where application variables can be set.
<cffunction name="onApplicationStart" ...>
<cfset application.testvariable="teststring">
</cffunction>
Livedocs information on all things Application.cfc
http://www.adobe.com/livedocs/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm? context=ColdFusion_Documentation&file=part_cfm.htm -
Same Application Variables name in different websites on the same server.
Hi,
I have two websites in the same server that use both their own Application.cfm file.
In each Application.cfm file is defined the application variable Application.DB
In website1 the Application.DB = DB1
In website2 the Application.DB = DB2
Since I'm studying Application.CFC solution, and I did read that application variables with same name have as scope the entire server ... I'm a bit worried. This happen also with Application.CFM ?Since I'm studying Application.CFC solution, and I did read that application variables with same name have as scope the entire server ... I'm a bit worried. This happen also with Application.CFM ?
That's not quite how it works. Each application has its own name, and application.foo on one application (name) is a different variable from application.foo within a different application (name).
Reading these sections of the docs might help:
Configuring and using application variables:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0c35c -7fec.html
cfapplication:
http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7d 69.html
About applications:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0b63c -7fda.html
Defining the application and its event handlers in Application.cfc:
http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24 -7d39.html
You should definitely be using Application.cfc, not Application.cfm, btw.
Adam
Adam -
Problems getting application variables to work
I basically want to alternate a message when a page is
loaded. First time loaded, message a. Second time loaded, message
b.
I have a database table (testCount) holding one row in one
column (theCount) and have tried the code attached below, but it
just will not work. Any advice?Hi Dan,
Thanks for you help again.
Assuming the syntax in the attached code is correct, I have
done the following:
1. Clear application structure to start from fresh using
<cfscript>structClear(application);</cfscript>
2. Commented the toggle code in onRequestStart() from
Application.cfc
3. In index.cfm, I uncommented the setting of the three
application variables commented out in the attached code.
I then previewed the page and it outputs the value set for
application.messageA as expected.
4. Uncommented the toggle code in onRequestStart() from
Application.cfc
5. In index.cfm, removed the code that set the 3 variables
and kept the output code. Refreshing the page once changes the
output from the messageA value to the messageB value, but each
subsequent refresh does not change the value.
This is so frustrating. It should work, unless my syntax is
wrong? -
I get this notification from our security group this a.m.
that states, "Application variables need to be removed from CF
applications during the next release because these can be accessed
by any application running on the same box and pose a security
risk."
I have checked documentation and searched for anything that
identifies this as a known issue or security risk for CF
Applications. But, have found nothing on this.
Lets say there are three CFMX 7 Applications all running on
the same server. We'll call them App_A, App_B, and App_C. If App_A
assigns a value to an application variable (i.e., <cfset
application.user_name="JDoe123">), is it then possible for App_B
and/or App_C to then reference, use, and/or change App_A's
application.user_name variable value?
Say by referring to the App_A application variable using
syntax similar to this:
<cfoutput>#App_A.application.user_name#</cfoutput>It's not quite as simple as you suggest, but it is quite easy
to list out the other applications on a server, including CF8, and
potentially "become" one of those applications. From there, the
options are wide open.
Here is some interesting reading on the subject:
http://corfield.org/blog/index.cfm/do/blog.entry/entry/Sharing_Application_Scope -
Reinitializing Application variable on local server? RESOLVED.
I changed the value of an application variable in my
Application.cfm page. I tried restarting the CF server several
times, but the value has still not been updated....
UPDATE: I fixed it. I was updating an Application.cfm page in
an incorrect folder...
OmarHmm... how about debugging the code concerned with the upload process?
Maybe the data changed.
Seriously: track down the code that raises the error and debug it.
- Lars -
Binded variables change value of modbus PLC variable when application starts
Hello,
I have a front panel with controls binded to some shared variables that use a modbus server to control a PLC. There is no logic behind that front panel, all I want to do is to be able to read/write some variables on the PLC.
I binded the control with datasocket. The reason I did not use PSP is that I would like to bind the controls programmatically so if the client change the server (that holds the library and the citadel BD) the only thing he would have to do is to change the name of the server in the configuration file. It's seems that there is a bug in the Data Bindingath Property and it always return me an error when I try to bind dynamically (Which is not the case with the DataSocket:URL Property) .
Now the PROBLEM:
Lets say a certains variable on the PLC holds the value 10. When I open my panel, I can see that value (10) a very short moment (milliseconds) and the value shifts to '0'. That undesirable '0' is indded written on the shared variable on the server and on the PLC. After that I can change the same value back and everything works properly. Its seems to me that the problem occurs only at the first connection. Same thing apend with booleans controls.
I would like to be able to open my application, see the '10' in my control, update it if I want, close the application and get the last value when I re-open it.
I'm running an executable with the DSC run-time.
Thanks in advance for your help!
VincentHello Vincent,
This was reported to R&D (#161821) for further investigation. I noticed that this only happens for controls in subVIs. Perhaps you could restructure your program so that it no longer needs to view the front panel of its subVIs. I will let you know if I find any other workarounds. Thanks for the feedback!
Regards,
Burt S -
The application has encountered a problem and needs to close
I'm building an application on LV using TABs, FPGA DLLs and DLLs that comunicate with CAN, GPIB and PCI devices.
The program apears to work properly but sometimes, and I can't see the patern, it crashes with the error "the application has encountered a problem and needs to close..."
Sometimes the error apears when I'm trying to exit the program, some other times it crashes before that.
I can't find the error because the program may work well for several hours and then crash or it crashes after 5 minutes of working with it.
Any clues on what is going wrong?
Regards,
Daniel Coelho
Daniel Coelho
VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
Controlar - Electronica Industrial e Sistemas, Lda
Solved!
Go to Solution.I'm still going through the example, but since the error ocours sporadicaly this could take some time to pinpoint the error.
I was reviewing the code and I was wondering about some simple things, like:
- I have to many local variables, could this be causing somekind of an error?
- since I'm using DLLs on my code, are there a way to make sure that all DLLs are loaded and unloaded correctly?
My program has a TAB with a simple TestStand user interface and when I change TABs I close the teststand ui; when I use that user interface I load and unload the same DLLs that I use on the other TABs, i. e., when using the UI I load all the DLLs that comunicate with the devices and when I change TABs I unload all the DLLs because on each separate TAB I can control those devices indicidually.
It's a bit hard to explain but I think I managed
Is there some truth on my questions? If so, what could I do?
Daniel Coelho
VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
Controlar - Electronica Industrial e Sistemas, Lda -
Performance: Database Update vs. Application variable
I am new to ColdFusion, so sorry if this has been covered before. I searched and couldn't find anything similar.
I am building an online Texas Hold'em poker application using ColdFusion and Flex. There are quite a few things that need to be stored on the server side that will be updated quite often and these objects will need to be accessed by multiple users. For example, think of something like the current pot between players on a table, or the current hand state (who's turn it is to check/bet/raise), or the current players in the hand. All of these things will be updated quite a few times per hand, and if you add to that that each of these will be different per table, it adds up quick.
Would it be better to store these things in the database or store them in an application variable? Or is there a better way that I am not thinking of? Is there any sort of metric to follow for these kinds of things?I don't think you'll find a documented general number of application variables you can have on a single server. But I think you could get away with 400 variables without any trouble.
Where you might run into trouble, though, is when you have multiple concurrent requests trying to read and change these values. You'll have to ensure that you single-thread write access to these variables using CFLOCK.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/
Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.
Maybe you are looking for
-
SSRS Cascading Parameter Setting Default Value of Parameter by Expression
Hi All, I need some help on an issue I am running into in SQL server 2008 report parameters. I have the following Report Parameters defined: 1) @PredefinedDateSelection - Boolean (User Selectable True/False, Default Value - 'False') 2) @StartDate - T
-
I just bought my new MacBook Pro 15" last month. When I try to connect to my 22" LG Flatron L227WTG display via VGA, the picture won't show up (except for rare occasions). When I turn it on with all the stuff connected, it'll show the picture for les
-
I have a parent folder called FHS Dance Competition, that contains several folders (one per team). I have this structure in my computer hard drive which I uploaded with one click to light room. In the past I've had to manually create each folder
-
I started seeing this kind of errors in sql logs after i moved databases to this server The activated proc '[SQLDependency].[SqlQueryNotificationStoredProcedure-9c377656-a13c-4732-a5a2-177bbc45c565]' running on queue 'EmailValidator.SQLDependency.Sq
-
I am trying to figure out why the explain plan (and performance) for the same query is different between our staging environment and our production environment when using the RESULT_CACHE hint. It's significantly worse in production. Platform and dat