Server.MapPath not accepting UNC URL

删除回忆录丶 提交于 2019-12-08 03:51:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!