How to call XML file in controller in nopcommerce 4.2

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
4 года назад
I created one xml file and that file I want to call in controller in nopcommerce 4.2. As per the .net multiple ways to call in which one of the solution is

//Controller code

string m_menuPath = ConfigurationManager.AppSettings["XmlMenuPath"];
document m_xDocument = XDocument.Load(Server.MapPath(m_menuPath));

this is not working showing error that
=> Using the generic type 'ConfigurationManager<T> requires 1 type arguments (first line error)
=> Server does not exist (second line error)

and same other code is also not working.
Note : this code is not working in nopcommerce only while in simple .net mvc its working verywell.

So, whats the way to call the xml file in controller in nopcommerce 4.2?
4 года назад
Do you want read XML file? If yes then follow use this code

var siteMap = new XmlSiteMap();
siteMap.LoadFrom("~/XML_FILE_PATH.ext");
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.