Hello we have used this script to replace specific lane in a file:
static void lineChanger(string newText, string fileName, int line_to_edit)
string arrLine = File.ReadAllLines(fileName);
arrLine[line_to_edit - 1] = newText;
We use similar like this :
lineChanger("education line" , "filetoreplace.txt" , 48);
Where 48 is the line to be replaced on the file. This is just an example.
Now the problem is at a random times this error : IOException: The process cannot access the file 'file path' because it is being used by another process
How can be modified the script to avoid that is not always is not always the error. The files we are replacing lines are .html files that run in the IIs web server.
I hope someone can help.