开发者

How to retrieve the XML file which is under the project folder

开发者 https://www.devze.com 2023-01-03 14:25 出处:网络
I having an XML file and that file is under the Documents folder. If I actually give the entire path in C# then I am able to retrieve the XML values, but if I give the project path then it is not get

I having an XML file and that file is under the Documents folder. If I actually give the entire path in C# then I am able to retrieve the XML values, but if I give the project path then it is not getting the values.

For example:

string fileNamePath=ConfigurationManager.AppSettings["XMLDocPath"].ToString() + fileName;
开发者_运维百科m_xmld.Load(fileNamePath);

It is throwing a runtime error.


What's the value of ConfigurationManager.AppSettings["XMLDocPath"]? Where is it defined?

It looks like you've simply got that set to the wrong value.

Also you should use Path.Combine to build up your full filename as this takes care of adding delimiters for you.

0

精彩评论

暂无评论...
验证码 换一张
取 消