var path = HttpContext.Current.Server.MapPath("~/TheXMLFile.xml"); here it is giving error 'HttpContext' does not exist in the current ExcelAddIn1 even i have try using this xml.LoadXml(@"~\App_Data\Product.xml");//Here given xml path location this is also giving error about path error message is as Data at the root level is invalid. Line 1, position 1. What I have tried: <pre> private void btnGetExcl_Click(object sender, EventArgs e) { List<string> name = null; XmlDocument xml = new XmlDocument(); //string path = @"~\App_Data\Product.xml.xml"; // xml.LoadXml(@"~\App_Data\Product.xml");//Here given xml path location var path = HttpContext.Current.Server.MapPath("~/TheXMLFile.xml"); var XmlData = XDocument.Load(path); // XmlNodeList xnList = xml.SelectNodes("/Trainings/Training"); // foreach (XmlNode xn in xnList) // { // new List<string>{ // xn["name"].InnerText // }; // } }
HttpContext
Quote:Contains application data files including .mdf database files, XML files, and other data store files. The App_Data folder is used by ASP.NET to store an application's local database, such as the database for maintaining membership and role information. For more information, see Introduction to Membership[^] and Understanding Role Management[^].
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)