Server.MapPath not accepting UNC URL
I'm having a bit of trouble loading an XML f开发者_运维百科ile 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.
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.
needs to be
\\\\servername\\folder\\folder\\whateverfileyouwant.ext
you have to escape the characters
精彩评论