I have written a method to save xml file to my project.and I run that method automatically in specific time period(once a day(at 3.00 pm)), same file. but we have to include that file to the project manually.What I want is before xml file save, look if it is exists. if it is exists delete it and save the new one and include it. this is my code.
this is how I save ....
public void sendValue()
{
string wbserviceUrl = "https://someurl.ashx";
WebClient clientOne = new WebClient();
string result = clientOne.DownloadString(wbserviceUrl);
XmlDocument cruisexmlDocument = new XmlDocument();
cruisexmlDocument.LoadXml(result);
cruisexmlDocument.Save("D:/projects/booksmal/XmlFiles/Cruisedata/product.xml");
}
In here I want to check,
- 1 -check if the file("product.xml") is exist.
- 2 -if it is exists then delete it and save the new ("product.xml")
- 3 -then include that file to the project(is this happen automatically when site host)
(Note: save the file is work fine)
Error 103 'System.Web.Mvc.Controller.File(string, string, string)' is a 'method', which is not valid in the given contextSystem.IO.Fileinstead ofFilenow how to include saved automatically to the project, without doing it manually