tags:

views:

972

answers:

2

We currently have code like this:

Dim xDoc = XDocument.Load(myXMLFilePath)

The only way we know how to do it currently is by using a file path and impersonation (since this file is on a secured network path).

I've looked at XDocument.Load on MSDN, but I don't see anything.

+5  A: 

I would suggest using a WebRequest to get a stream and load the stream into the document.

paulwhit
I wonder what the difference in overhead is between opening a file over the network versus using a WebRequest...
Elmo Gallen
+3  A: 

That very documentation says that the file parameter is "A URI string that references the file to load into a new XDocument." Furthermore, I have code that does exactly that---uses XDocument.Load with a URI.

Domenic
And by URI, you specifically mean a URL and not a file path? I haven't had any luck passing in a URL to XDocument.Load().
Elmo Gallen
Yes, my code definitely passes in a URL, of the "http://stuff" type. And it works. Not sure what to tell you if you don't have any luck... :-|.
Domenic
This worked for me, too.
Mike C.