I am using a C# (asp.net MVC) application to create a csv file. This csv file is then used as an input to a R script.
When trying to execute the R script using the csv file created by the application I get the error: cannot open file : Permission denied
However, if I open the csv file and re-save it then the R script executes fine.
My C# code:
if (!System.IO.File.Exists("RCodeInput.csv")) {
string[] header = new string[] { "ID, FolderName" };
System.IO.File.WriteAllLines(filename, header);
}
// Within a loop (some logic to create ID and FolderName)
string[] to_write = new string[] { "ID_ToWrite, FolderName_ToWrite" };
System.IO.File.AppendAllLines(filename, to_write);
Any ideas on how to save this with the correct security/permissions?