Server.MapPath不接受UNC URL

时间:2011-03-02 15:56:40

标签: asp.net url unc mappath

我在使用ASP加载XML文件时遇到了一些麻烦。 这是XML文件的位置(它是UNC网址):

\\ilife104\teamdisk\Shared\Integration\System\dev\Data\prcImportFactSetFeeds\fileList.xml

这是我的代码:

<% 
'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
%>  

它给出错误:

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. 

有人知道解决方案吗? 詹姆斯,先谢谢你。

2 个答案:

答案 0 :(得分:4)

Server.MapPath采用页面相对路径(例如../Images/Something.png)并在磁盘上返回完整路径。

由于您已有文件路径,因此根本不应致电Server.MapPath

答案 1 :(得分:0)

需要

\\\\servername\\folder\\folder\\whateverfileyouwant.ext

你必须逃避角色