Dimitris Sapikas
Dimitris Sapikas

Reputation: 622

VB silverlight for windows phone "System.IO"

hello i am having an error : "Attempt to access the method failed: System.IO.File.Exists(System.String)"

i have to note that this line is having an external url

If File.Exists("http://www.demo.com/demo.xml") Then blah end if

during my first try it worked but now it seems bugy :S it does not make sense !

Upvotes: 0

Views: 166

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1499760

It sounds like you should be making a web request (e.g. with WebClient) instead.

You're using File.Exists and passing it a URL. File.Exists is meant to be for file system paths. In fact, you're not meant to call File.Exists at all on Windows Phone 7. When in doubt, consult the documentation:

This member has a SecurityCriticalAttribute attribute on Silverlight for Windows Phone, because the attribute was present in Silverlight 3. This attribute restricts this member to internal use. Application code that uses this member throws a MethodAccessException.

Upvotes: 4

Related Questions