How to retrieve the XML file which is under the project folder
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.
精彩评论