Server.MapPath 不接受 UNC URL
我在使用 ASP 加载 XML 文件时遇到了一些问题。 这是 XML 文件的位置(它是 UNC url):
\\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.
有人知道解决方案吗? 预先感谢,詹姆斯。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Server.MapPath
采用页面相对路径(例如../Images/Something.png
)并返回磁盘上的完整路径。由于您已经有了文件路径,因此您根本不应该调用
Server.MapPath
。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
you have to escape the characters