Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Path not found - Virtual directorys / File system objects

Status
Not open for further replies.

vnad

MIS
Nov 22, 2002
91
US
I have the following code

<BODY>
The path of the virtual directory is <% Response.Write Server.MapPath("VD_Path\SQL") %>

<%
set oFso=Server.CreateObject("Scripting.FileSystemObject")
For Each oFile In oFso.GetFolder(Server.MapPath("VD_PATH\SQL")).Files
Response.write(oFile.DateCreated)
next
%>
</BODY>

VD_PATH is a virtual directory to another server shared drive. The first part comes back with the correct path to the server but the 2nd part (Get folder) comes back with path not found.

Any ideas?
 
there's a couple threads within the last week or so here ( first couple pages of posts ) with this same issue, mostly permissions for the drive share do not include the IUSR, and faults the code out. IIS (runs as system) can cross those boundries with virtual folders, but FSO (runs as web user) has a little more trouble.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
This was one place I struggled with and gave up since I didn't have permissions to add users to our company's domain.

See this thread: thread333-934837 to get some insight on your problem.

Since I didn't have the permissions to mess around with user accounts I coulnd't test out the suggestions. If you have that ability, figure out what your web server's annonymous user account is and see about adding that to the your network domain's user list. This is usually IUSR_WebServerName, where WebServerName is the name of your web server.

Good luck! I'd be intersted in any results or success you may have!

Earnie Eng
 
It works once I give IUSR permissions on the remote server to the directories I need to go after. I still have some questions though.

What is the point of Virtual directories then if you can just put in the UNC path ie

<%
set oFso=Server.CreateObject("Scripting.FileSystemObject")
For Each oFile In oFso.GetFolder(Server.MapPath("\\SERVERNAME\SHARE")).Files
Response.write(oFile.DateCreated)
next
%>

Is it just so you can control the path in IIS instead of the code?
 
Virtual Directories are useful if you don't have control over the server. Say for example you have your site hosted at some third party web hosting service. Generally the service wouldn't want you to know their server's directory structure for security purposes. In that case, the mapPath function allows you find the correct path even if you didn't know the directory structure of the server.

Earnie Eng
 
... and virtual directories allow you to apply different "schemes" to a website, like security, variables, environments etc. you can even give them their own seperate global.asa in the sense of FSO, there's no need for virtuals, but web / site wise it's very useful in shortcutting or allowing access to a folder outside the web scope.

[thumbsup2]DreX
aKa - Robert
if all else fails, light it on fire and do the happy dance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top