This content has been marked as final. Show 6 replies
Don't *discuss* your code, POST your code...
Sure, but it is right out of the manual. Here is my onRequest:
<CFFUNCTION NAME="onRequest" RETURNTYPE="void">
<CFARGUMENT NAME="targetPage" TYPE="string" REQUIRED="true"/>
The only other thing I did was to configure IIS with virtual directories. The above code works fine when the CFM files are in InetPub (and accesssed at http://www.testserver.com). When I put the files in a virtual directory,c alled "v20" and access as http://www.testserver.com/v20., the following error occurs.
Could not find the included template /v20/index.cfm.
Note: If you wish to use an absolute template path (e.g. TEMPLATE="/mypath/index.cfm") with CFINCLUDE then you must create a mapping for the path using the ColdFusion Administrator. Using relative paths (e.g. TEMPLATE="index.cfm" or TEMPLATE="../index.cfm") does not require the creation of any special mappings. It is therefore recommended that you use relative paths with CFINCLUDE whenever possible.
The error occurred in C:\v20\Application.cfc: line 166
164 : <CFARGUMENT NAME="targetPage" TYPE="string" REQUIRED="true"/>
165 : <CFSET DSN="#This.DSN#">
166 : <CFINCLUDE TEMPLATE="#Arguments.targetPage#">
167 : </CFFUNCTION>
When I log the value of Arguments.targetPage I get /v20/index.cfm. Why isn't it just /index.cfm? If I create a mapping, it will work, but in my onRequestStart I look for several special pages and have to add "/v20" to the page path. I'd prefer not to do that, since the virtual directory may vary.
I've just tested what I figured was similar to your situation, and it all
seemed OK to me. Not much help in saying that, other than it's not a
fundamental cock-up in CF
I have this:
C:\temp\Application.cfc (/temp virtual directory off webroot)
If I browse to test.cfm, the onRequest event handler runs (I'm using the
event handler you posted, with a one-line output in it saying "yes, I ran
Is that pretty much what you've got?
What exact version of CF are you running? I'm running 7,0,2,142559 (J2EE
Yes, sounds like what I have. I just want to stress that I'm creating a virtual directory and not a virtual web site. And I am running version 7,0,2,142559 of CF.
Did you create a mapping in order for this to work?
Also, if you log the targetPath in onRequest (same for onRequestStart), do you see /temp/test.cfm or do you see /test.cfm? I obviously see the first and it doesn't work without a mapping?
I did a quick experiment that may shed some light on the problem. So far I've been running the app on W2K, which has IIS 5.0 (I think). If I run the same app on W2003 it works fine.
Is anyone having the problem I've observed above on W2K with IIS 5.0? Is this a known problem IIS 5.0?
My tests were on WinXP and whatever-the-hell-half-arsed-version-of-IIS that
In answer to the other questions from the preceding post (which could be
moot now), are:
1) a v/dir, not a v/website (don't even know what one of those is!)
2) no CF mapping necessary.