使用 XPath.XPathDocument() 函数时出错

发布于 2024-10-11 05:41:25 字数 288 浏览 0 评论 0原文

我在 ASP.NET/VB.NET 项目中使用此代码:

Dim sourceFile as String = "http://xml.weather.yahoo.com/forecastrss?p=94704"
Dim xPath As New XPath.XPathDocument(sourceFile)

第二行给出错误: “无法连接到远程服务器”

当我在网络浏览器中浏览 url (sourceFile) 时,它可以很好地打开 RSS 提要页面。 我怎样才能消除这个错误?

I'm using this code in my ASP.NET/VB.NET project:

Dim sourceFile as String = "http://xml.weather.yahoo.com/forecastrss?p=94704"
Dim xPath As New XPath.XPathDocument(sourceFile)

and the second line gives the error:
"Unable to connect to the remote server"

When I browse the url (sourceFile) in web browser, it opens the RSS feeds page finely.
How can I remove this error?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

思慕 2024-10-18 05:41:25

如果您的应用程序无法连接到远程服务器,则这里没有关于XPath.XPathDocument的内容。

使用另一种方法检查连接,例如WebClient

Here is nothing about XPath.XPathDocument if your application is unable to connect to the remote server.

Check the connection using another method, e.g. WebClient.

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