【问题标题】:VB silverlight for windows phone "System.IO"VB silverlight for windows phone "System.IO"
【发布时间】:2012-05-12 15:56:24
【问题描述】:
你好我有一个错误:
“尝试访问方法失败:System.IO.File.Exists(System.String)”
我必须注意这一行有一个外部网址
If File.Exists("http://www.demo.com/demo.xml") Then
blah
end if
在我第一次尝试时,它起作用了,但现在它似乎有问题:S
这没有意义!
【问题讨论】:
标签:
.net
windows
vb.net
windows-phone-7.1
【解决方案1】:
听起来您应该改为发出网络请求(例如使用WebClient)。
您正在使用 File.Exists 并向其传递 URL。 File.Exists 用于 文件系统 路径。事实上,在 Windows Phone 7 上您根本不应该致电 File.Exists。如有疑问,请咨询 the documentation:
此成员在 Silverlight for Windows Phone 上具有 SecurityCriticalAttribute 属性,因为该属性存在于 Silverlight 3 中。此属性将此成员限制为内部使用。使用此成员的应用程序代码会引发 MethodAccessException。