Access a mapped network drive from ColdFusion

I have a problem accessing a mapped drive in ColdFusion. I have \\server\files\sharing mapped to z:\ . If I run this code, it says that the directory exists for the full path, but not for the displayed one:

 <cfscript> fullPath = "\\server\files\sharing\reports"; mappedPath = "z:\reports"; WriteOutput("fullPath exists: #DirectoryExists(fullPath)#<br/>"); //YES WriteOutput("mappedPath exists: #DirectoryExists(mappedPath)#"); //NO </cfscript> 

I did some Googling and found several people with the same problem, but the solution always used the full path. Is there a reason ColdFusion will not be able to see or access the mapped drive? And if so, are there any workarounds (perhaps a system call to get the full path to the mapped drive)?

+6
coldfusion windows file networking
source share
1 answer

The reason ColdFusion cannot access the mapped drive is because it runs as a service on Windows.

A service (or any process that works in a different security context) that must access a remote resource must use the Universal Naming Name (UNC) to access the resource.

This was extracted from the following knowledge base article: http://support.microsoft.com/kb/180362

You may be able to change the service to run as a separate user with the mapped drives (I have not checked if this works, but it can), but you should use the UNC path instead of the mapped drive.

+5
source share

All Articles