Welcome to WebProNews Breaking eBusiness and Search News
Advertise | Newsletter | Sitemap | News Feeds News Feed 
 WebProNews Search Part of the iEntry network iEntry inc. 

Coldfusion: Duplicate Application Name Issue

Raymond Camden
Expert Author
Published: 2007-04-13

WebProNews RSS Feed


A friend of mine was tearing his hair out trying to solve a problem that occurred randomly.

For some reason he would get an error about a certain application variable not existing. He showed me the code - and we both agreed that this was simply not possible.

The variable was clearly being defined in the application.

The error would normally occur after some amount of down time. If he started the application himself he could never recreate the error.

I had him turn down the application timeout to 5 minutes, let the application time out, and we still couldn't recreate the issue.

Turns out the problem was far simpler. He had another application on the site with the same name!

The reason the error would occur randomly and after a period of inactivity was that sometimes the other application would load up before the one that was throwing errors.

So this brings up the question - how do you prevent this? On a box that you control this is relatively simple. You could do a global search and replace over all the folders that contain code.

Unfortunately, this will only be easily done for cfapplication tags. You would also need to search for this.name but only inside Application.cfc files. It is possible though. (Do I smell a new Friday Puzzler?) On a shared server though this is impossible, and even if you did do a scan, some other client can easily upload code after you scan. (To be clear, this is a problem on a shared server where you share one ColdFusion instance.)

You can help prevent this by using unique application names. Since the only purpose of the application name is to give the code a unique memory space on the server, you don't have to make a 'friendly' name at all.

You could use a long name - just be sure the name is less than or equal to 64 characters in length. As an example, consider this code from BlogCFC. It actually uses a "base" name and also adds part of the file path to it. I did this for folks running BlogCFC on shared servers:

<cfset prefix = hash(getCurrentTemplatePath())>
<cfset prefix = reReplace(prefix, "[^a-zA-Z]","","all")>
<cfset prefix = right(prefix, 64 - len("_blog_#blogname#"))>
<cfapplication name="#prefix#_blog_#blogname#" sessionManagement="true" loginStorage="session">


Comments

View All Articles by Raymond Camden



Receive Our Daily Email of Breaking eBusiness News


About the Author:
Raymond Camden, ray@camdenfamily.com
http://ray.camdenfamily.com

Raymond Camden is Vice President of Technology for roundpeg, Inc. A long time ColdFusion user, Raymond has worked on numerous ColdFusion books and is the creator of many of the most popular ColdFusion community web sites. He is an Adobe Community Expert, user group manager, and the proud father of three little bundles of joy.

WebProNews RSS Feed

More Expert Articles Articles

Contact WebProNews
Advertisement





TOP NEWS

WebProBlog
The official blog of WebProNews.

Go to WebProBlog

Targeted Information for Business
WebProNews is part of the iEntry network

Internet Business: Marketing: Small Business:
WebProNews MarketingNewz SmallBusinessNewz
WebProWorld AdvertisingDay PromoteNews
EcommNewz SalesNewz EntrepreneurNewz

Software: Search Engines: Web Design:
WebMasterFree Jayde B2B DesignNewz
NetworkingFiles SearchZA FlashNewz
SecurityConfig SearchNewz WebSiteNotes

Developer: IT Management: Security:
DevWebPro ITManagement SecurityProNews
DevNewz SysAdminNews SecurityConfig
TheDevWeb NetworkingFiles NetworkNewz

The iEntry Network consists of over 100 web publications reaching millions of Internet Professionals. Contact us to advertise.
eBUSINESS RESOURCES






 Advertise | Contact Us | Corporate | Newsletter | Sitemap | Submit an Article | News Feeds
 WebProNews is an iEntry, Inc. ® publication - $line) { echo $line ; } ?> All Rights Reserved
WebProWorld
Ten most recent posts.


SearchBrains.com
NetworkingFiles
Featured Software


About WebProNews
WebProNews is the number one source for eBusiness News. Over 5 million eBusiness professionals read WebProNews and other iEntry business and tech publications.

WebProNews provides real-time coverage of internet business.

Free Email Newsletters:
WebProNews SearchNewz
WebProWorld DevWebPro
Marketing SecurityNews
Plus over 100 other newsletters!

Send me relevant info on products and services.


iEntry.com WebProWorld RSS Feed WebProWorld Contact WebProNews Print Version Email a friend Bookmark us SearchBrains.com SearchBrains RSS Feed