问题
I'm having a bit of trouble loading an XML file with ASP. This is the location of the XML file (it's a UNC url):
\\ilife104\teamdisk\Shared\Integration\System\dev\Data\prcImportFactSetFeeds\fileList.xml
And this is my code:
<%
'load the XML file..
Option Explicit
Response.Buffer = True
Dim xml
Set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = False
xml.load (Server.MapPath("\\ilife104\teamdisk\Shared\Integration\System\dev\Data\prcImportFactSetFeeds\fileList.xml"))
Dim name, retrieved
name = xml.documentElement.childNodes(0).text
retrieved = xml.documentElement.childNodes(2).text
Set xml = Nothing
%>
It gives the error:
Server.MapPath() error 'ASP 0174 : 80004005'
Invalid Path Character(s)
/ITWeb/Interfaces/je/index.asp, line 9
An invalid '/' or '\' was found in the Path parameter for the MapPath method.
Does anybody know a solution?? Thanks in advance, James.
回答1:
Server.MapPath
takes a page-relative path (eg, ../Images/Something.png
) and returns a full path on disk.
Since you already have a file path, you should not call Server.MapPath
at all.
回答2:
needs to be
\\\\servername\\folder\\folder\\whateverfileyouwant.ext
you have to escape the characters
来源:https://stackoverflow.com/questions/5170025/server-mappath-not-accepting-unc-url