0
I am developing a site in . NET Core Razor Pages. How can I make a file indicate to a variable? For example:
var xml = (~/MenuXML/menu.xml);
OBS: I need it to be string, the file data.
Motive: I’m trying to turn it into JSON. The code I’m using is following:
var xml = (~/MenuXML/menu.xml);
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string json = Newtonsoft.Json.JsonConvert.SerializeXmlNode(doc);
HttpContext.Session.SetString("xmltojson", json);