-1

I have a web application and I need to update data in XML file named as "Setting.xml". I try this code for get the path:

XmlDocument doc = new XmlDocument();
doc.Load(AppDomain.CurrentDomain.BaseDirectory + "Setting.xml");

I use the web service. This code is work locally good, but after uploading to the server it doesn't work fine. Could you help me, where is the error?

Uğur Aldanmaz
  • 1,018
  • 1
  • 11
  • 16
Mohamed E
  • 1
  • 7
  • 1
    did you try to print out AppDomain.CurrentDomain.BaseDirectory on screen or into a logfile ? (could be that that points to a in your case wrong directory) – Thomas Sep 15 '14 at 08:10
  • I would refer you to this answer: http://stackoverflow.com/a/1199426/1432385 – Lucaci Andrei Sep 15 '14 at 08:13
  • Have a look at [this](http://stackoverflow.com/questions/674857/should-i-use-appdomain-currentdomain-basedirectory-or-system-environment-current) – huMpty duMpty Sep 15 '14 at 08:22

1 Answers1

0

On the Server, check whether the Path AppDomain.CurrentDomain.BaseDirectory + "Setting.xml" is valid and the file exists.

bit
  • 4,407
  • 1
  • 28
  • 50