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.

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

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

3 Comments

@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.
@SonerGönül I have read those links and posted here to avoid unnecessary entropy, its better than nothing right?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.