Issue

There are times when including files (usingcfinclude or cfmodule) from a directory outside of the document root can be very useful. This can be done using the Mappings link within the ColdFusion Administrator, which is documented in the Configuring and Administering ColdFusion MX manual on LiveDocs.

This Mappings feature works well when the directory that's being mapped is on the local filesystem. If it is on another machine on the local network, there is a Windows Security restriction to be aware of. There is a workaround to the limitation, however.

Solution

Option 1:

This is the recommended solution. This workaround simply requires that you use the Universal Naming Convention (UNC) notation in the Mappings definition in the ColdFusion MX Administrator instead of a mapped Windows drive letter.

  1. Create the remote Windows share.
  2. Open the Windows Services control panel.
  3. Select the ColdFusion MX Application Server service.
  4. Right-click on the service and select Properties.
  5. Select the Log On tab.
  6. Select the "This account" option. Specify a domain account and password that has privileges to the remote directory in question. Click OK.
  7. Restart the ColdFusion MX Application Server Service.
  8. Create the ColdFusion MX mapping using the UNC notation (for example, \\{machineName}\shareName) of the shared directory in the Directory Path box on the Mappings page within the ColdFusion MX Administrator.

Option 2:

Only use this workaround if you must use a drive letter instead of a UNC notation in the Mapping definition. This workaround requires ColdFusion MX to run as a Windows process (in a Command/DOS window) instead of a Windows service.

  1. Create the remote Windows share.
  2. Map a local logical drive letter to the remote share (you will need the correct Windows security privileges to do this).
  3. Stop the ColdFusion MX Application Server Service if it's running.
  4. Start ColdFusion MX as a Windows process:
    1. Open a Command box (Start > Run > cmd)
    2. Change directory to the cf_root\bin directory (for example, cd \cfusionmx\bin)
    3. Type cfstart.
  5. Create the ColdFusion MX mapping using the mapped drive letter of the shared directory in the Directory Path box on the Mappings page within the ColdFusion MX Administrator.

At this point, you will be able to access (cfinclude, cfmodule) any ColdFusion file in the remote directory from a ColdFusion page by using the ColdFusion mapping in a URL (for example, http://{myCFMXserver}/images/photo.jpg or /images/photo.jpg).

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy