tags:

views:

447

answers:

1

Like the title says, the error I get is the following:

An invalid '/' or '\' was found in the Path parameter for the MapPath method.

I'm using ASP classic and basically trying to access a folder on one of our servers. I Googled around and judging from what most people say, I should take off the \ prefix from my server path. But when I do that, the code cannot find the server. The code I'm using is:

Dim fileSystem
Set fileSystem = Server.CreateObject("Scripting.FileSystemObject")

fileSystem.GetFolder(Server.MapPath("\\servername"))

So my question is, how can I use the FileSystemObject to access a servers' files and folders?

Thank you.

+1  A: 

First, Server.MapPath is never going to like "\\servername" because that's a UNC path to a windows server, not a portion of a URL. If you want to get that, this might work:

fileSystem.GetDrive("\\servername")

Second, if you are really looking for a URL, it should be an absolute URL starting with a / or a relative URL starting without a / and that will be relative to the current .ASP page. If you aren't processing a request, you'll only be able to use an absolute URL.

Joseph Bui