Server.MapPath 不接受 UNC URL

发布于 2024-10-19 23:27:19 字数 893 浏览 9 评论 0原文

我在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧城空念 2024-10-26 23:27:19

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.

天冷不及心凉 2024-10-26 23:27:19

需要是

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

你必须逃避角色

needs to be

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

you have to escape the characters

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文