xmlProNews News Archives About Us feedback

Recent Articles

Using Sitemaps And Verity
Not many people know that ColdFusion ships with a HTTP spider that integrates with Verity. Unfortunately, this spider will only work with localhost as a server. This means if you want to spider multiple sites, you....

Persisting With XML, Or Else
There are a few ways of persisting XML to a file, each with their pros and cons, that programmers may want to consider. Brett D. McLaughlin, Sr., of O'Reilly Media, penned a post on XML persistence and ways...

Have You Validated Your Feed Recently?
When is the last time you stopped to think about the health of your feed? Maybe it's time to head over to the Feed Validator and ensure it's in peek performance.

CFFEED Bug To Watch Out For
I've blogged before about how xmlFormat() is a bit buggy. While it will remove most characters, including "high ascii" characters in the range of 128-255...

Ping Using XML-RPC In ASP.NET
Many blogs have the ability to ping different ping-services, such as Ping-o-Matic, Feedburner and Technorati, whenever some content is created...


10.16.07


Caching CFCONTENT

by Raymond Camden

A few days ago I blogged about a code review I was doing for another client. Yesterday I found another interesting bug in their code. (It is always easier to find bugs in other people's code.)

The code in question was an API tester for their web site. The page had a nice set of links to let you test all of their XML based responses for their site. I noticed something odd in one test. The first time I ran the test, I got a nicely formatted XML result in the browser. The second time however I got an odd jumble of text.

Viewing the source revealed that the XML was there ok. I took a look at the code and spotted the problem right away. See if you can as well:



If you don't recognize cf_scopecache, it is just a caching custom tag. It takes the text result of the stuff inside it and stores it.

Cost Effective Website and Network Monitoring
IPCheck Server Monitor - Free Download

And that's where our problem is. Our caching tag caches the text. But the CFCONTENT tag is a Request specific tag. By that I mean it changes the current request. The first time the page is hit, it will execute, as will all the code inside the scopeCache custom tag. The second time though only the text is returned. CFCONTENT isn't run. The fix was simple - move the CFCONTENT:



The same issue would exist if you used CFCACHE on top of the page.

Comments


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.

About xmlProNews
xmlProNews is a collection of news and commentary designed to keep you in step with the ever evolving landscape of XML environments. News and Advice for XML Professionals

xmlProNews is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQLProNews.com
ITcertificationNews.com SysAdminNews.com
LinuxProNews.com WirelessProNews.com
CProgrammingTrends.com SysAdminNews.com


-- XMLProNews
is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2007 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article