Hi,
I have created a .net core web api v3 project, and in this project I am reading a xml file, the coding is work awesome in local environment but as soon as I push the code in Azure Web App using GitHub, the line which reads the xml file is sending error to me "Could not find file 'D:\home\site\wwwroot\EmailTemplates.xml'."
Please help.
My code is attached below:
public ArrayList Fetch(string whichNode)
{
var language = "English";
var doc = new XmlDocument();
doc.Load("EmailTemplates.xml");
var root = doc.DocumentElement;
var nodes = root.SelectNodes("//Email/" + language + "/" + whichNode);
var list = new ArrayList();
foreach (XmlNode node in nodes)
{
list.Add(node["Subject"].InnerText.Trim().Replace("\r", string.Empty).Replace("\n", string.Empty));
list.Add(node["Message"].InnerText.Trim().Replace("\r", string.Empty).Replace("\n", string.Empty));
}
list[1] = list[1].ToString()
.Replace("@[", "<strong>")
.Replace("]@", "</strong>")
.Replace("[LB]", "<br/>");
return list;
}
You can check the code in postman from this url :
http://motorlogs.azurewebsites.net/api/verifications/forgotPassword
with this body parameter:
{
"email": "emadkhanqai@gmail.com"
}