Question
Components and virtual directories.
CF8hf3, W2K3, IIS.
Site1\application.cfc (-> this.name = "site1";)
Site1\Components\MyComponent.cfm
Site1\UseComponentToShowSiteNameOnSite1.cfm
Site2\application.cfc (-> this.name = "site2";)
Site2\Components ... this is an IIS virtual directory that points to Site1\Components
Site2\UseComponentToShowSiteNameOnSite2.cfm
Problem #1
Create this cfc and place it in \Site1\Components. The virtual directory makes it available to site2 as well. The website root for the site containing the virtual directory has a different application.cfc than the website that has this test component in it's physical structure.
<cfcomponent displayname="test component">
<cffunction name="TestFunction" output="No" returntype="string" access="remote">
<cfreturn application.applicationname>
</cffunction>
</cfcomponent>
If this component is called directly:
http://site2/Components/test.cfc?method=testfunction
it returns the applicationname for site1, however, when used like so:
<cfoutput>
#createobject("Component", "site2.Components.Test").TestFunction()#
</cfoutput>
it returns site2.
Problem #2
A CFGrid tag on site2 with this bind attribute:
bind="cfc:site2.Components.Test.TestFunction({cfgridpage}...
generates this js in the rendered page:
ColdFusion.Bind.cfcBindHandler(<snip>... :_cf_grid_errorhandler,'cfc':'/site1/Components/test.cfc','cfcFunction':'TestFunction' ...<snip>
On both occasions it appears the cf server traverses the physical path and uses that to resolve Application.cfc which is different behavior than any other processed file.
Thanks!
Mischa.
Site1\application.cfc (-> this.name = "site1";)
Site1\Components\MyComponent.cfm
Site1\UseComponentToShowSiteNameOnSite1.cfm
Site2\application.cfc (-> this.name = "site2";)
Site2\Components ... this is an IIS virtual directory that points to Site1\Components
Site2\UseComponentToShowSiteNameOnSite2.cfm
Problem #1
Create this cfc and place it in \Site1\Components. The virtual directory makes it available to site2 as well. The website root for the site containing the virtual directory has a different application.cfc than the website that has this test component in it's physical structure.
<cfcomponent displayname="test component">
<cffunction name="TestFunction" output="No" returntype="string" access="remote">
<cfreturn application.applicationname>
</cffunction>
</cfcomponent>
If this component is called directly:
http://site2/Components/test.cfc?method=testfunction
it returns the applicationname for site1, however, when used like so:
<cfoutput>
#createobject("Component", "site2.Components.Test").TestFunction()#
</cfoutput>
it returns site2.
Problem #2
A CFGrid tag on site2 with this bind attribute:
bind="cfc:site2.Components.Test.TestFunction({cfgridpage}...
generates this js in the rendered page:
ColdFusion.Bind.cfcBindHandler(<snip>... :_cf_grid_errorhandler,'cfc':'/site1/Components/test.cfc','cfcFunction':'TestFunction' ...<snip>
On both occasions it appears the cf server traverses the physical path and uses that to resolve Application.cfc which is different behavior than any other processed file.
Thanks!
Mischa.