1

I had a requirement of reading a XML document from the server on which the application is running. I am able to do it by simply accessing a file by passing string url as the parameter.

XmlDocument doc = new XmlDocument();
doc.Load(fullPath);  //fullPath is a string. for e.x. c:\myfolder\myxml.xml

Now the requirement changes to access the file from a different server so for that I am simply modifying my fullPath as

\\p.o.r.t\c$\myfolder\myxml.xml

But it fails to read the file. Is there some other way to access files placed on a different server.

P.S.: If I use the same URL and paste it in URL, I am able to access the file.

Saksham
  • 9,037
  • 7
  • 45
  • 73

2 Answers2

1

So I finally figured it out. The folder which I was trying to access wasn't shared for the Authenticated Users. Sharing it solved the problem.

Saksham
  • 9,037
  • 7
  • 45
  • 73
0

Here is some posts that contains a valid answer:

Access files from network share in c# web app

Asp.net Access To Network Share

and detailed problem explained here:

http://support.microsoft.com/kb/207671

Good luck

Community
  • 1
  • 1
Tim
  • 2,695
  • 3
  • 33
  • 39
  • 2
    [Are answers that just contain links elsewhere really “good answers”?](http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers) – Soner Gönül Sep 30 '14 at 06:10
  • 1
    @SonerG no, that's not good answer, but that is a great answer. That is much better even for question author, because it let him to think and do something. Or you wanna someone writes the code for you? It is your job and only you have to do it, if you have an issue, so the people are help here. But author even didn't try to search on SO. So This is the best answer. – Jonik Sep 30 '14 at 06:32
  • @SonerGönül I have read those links and posted here to avoid unnecessary entropy, its better than nothing right? – Tim Sep 30 '14 at 07:01